What happens if I call jQuery.post() with an empty url?
If I submit a form with an empty action field, it su开发者_如何学JAVAbmits to the current page--is this the case with ajax requests?
I fell over this question when wondering the same about the $.ajax
method. It turns out that it works in chrome, but not IE if you have a blank URL.
That's correct, it submits to the current page.
Reference, jQuery documentation:
url (String)
Default: The current page
A string containing the URL to which the request is sent.
Source
This parameter is not marked as Optional. Some errors are possible.
http://docs.jquery.com/Post
精彩评论