jQuery Validation not working in server! Works Locally. Why?
When I tried jQuery validation locally it works fine. But when I upload to my server the validation is not working. The page just simply reloads. Why is it so?
Here is the fiddle.
htt开发者_如何学Pythonp://jsfiddle.net/anish/Q9qes/3/
In your JSFiddle, under Manage Resources, your link to the jQuery Validation plugin is giving a 404 error. Maybe that's why it's not working on your server.
EDIT:
There is no such tag as </input>
. Remove those.
Perhaps run your HTML & CSS through a validator.
Also, the version of your jQuery Validation plugin is not up to date with your jQuery version.
well jquery is a client side library which runs on browser. it doesnt have relation with what server you are using. if your jquery is having some connection with serverside files, then there is a problem in definitions of URLs in your jquery files. please recheck all the URLs again in your jquery files. Specially in those functions in which you are using Jquery AjaX
The your page works locally is because your page is correctly linked to your jquery library (am guessing is in a folder called js/jquery.min.js), however remotely the js folderdoesn't contain the jQuery.min.js library in the folder.
Solution one: You can either ensure that the jQuery.min.js library actually exists on your remote server or...
Solution two (which is a better one): Let Google host JQuery for you. by changing the below from:
enter code here<script type="text/javascript" src="/js/jQuery.min.js"></script>
to:
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js">
. This will enable it to work both remotely and locally. Doing this also has other upsides you might find advantageous.
check out: http://encosia.com/3-reasons-why-you-should-let-google-host-jquery-for-you/
I hope this helps
Reference:
Dave Ward, 2011. 3 reasons why you should let Google host jQuery for you. [online] Available at: http://encosia.com/3-reasons-why-you-should-let-google-host-jquery-for-you/ [Accessed 24 MArch 2012 ].
精彩评论