如果我用空url调用jQuery.post()会发生什么?

时间:2022-12-05 17:02:43

If I submit a form with an empty action field, it submits to the current page--is this the case with ajax requests?

如果我提交一个带有空操作字段的表单,它会提交到当前页面 - 这是ajax请求的情况吗?

3 个解决方案

#1


6  

That's correct, it submits to the current page.

这是正确的,它提交到当前页面。

Reference, jQuery documentation:

参考,jQuery文档:

url (String)
Default: The current page
A string containing the URL to which the request is sent.

url(String)默认值:当前页面包含发送请求的URL的字符串。

Source

资源

#2


8  

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.

当想知道$ .ajax方法时,我忽略了这个问题。事实证明它适用于chrome,但如果你有一个空白的URL,则不适用于IE。

#3


2  

This parameter is not marked as Optional. Some errors are possible.

此参数未标记为“可选”。有些错误是可能的。

http://docs.jquery.com/Post

http://docs.jquery.com/Post

#1


6  

That's correct, it submits to the current page.

这是正确的,它提交到当前页面。

Reference, jQuery documentation:

参考,jQuery文档:

url (String)
Default: The current page
A string containing the URL to which the request is sent.

url(String)默认值:当前页面包含发送请求的URL的字符串。

Source

资源

#2


8  

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.

当想知道$ .ajax方法时,我忽略了这个问题。事实证明它适用于chrome,但如果你有一个空白的URL,则不适用于IE。

#3


2  

This parameter is not marked as Optional. Some errors are possible.

此参数未标记为“可选”。有些错误是可能的。

http://docs.jquery.com/Post

http://docs.jquery.com/Post