jquery $ .post在Firefox中不起作用

时间:2022-12-06 21:18:36

I am begging to use jquery. I have the following call that works in IE7 but not FF 3.0.4. But if I change the null to {} it works fine. Is null not valid for this case and I just got lucky that it worked in IE or is this an error with jquery.

我乞求使用jquery。我有以下调用适用于IE7但不适用于FF 3.0.4。但是,如果我将null更改为{},它可以正常工作。 null对于这种情况无效,我很幸运它在IE中工作或者这是jquery的错误。

$.post("complexitybar.ashx?a=init&vc=" + validationCode, null, loadInitialValues, "json");

3 个解决方案

#1


6  

Try $.get() for query-string requests:

尝试$ .get()查询字符串请求:

$.get('complexitybar.ashx?a=init&vc=...')

POST requests expect the URL and key-value pairs to be seperate:

POST请求期望URL和键值对是分开的:

$.post('complexitybar.ashx', 'a=init&vc=...')

With POST requests, the key-value pairs are sent as content data rather than as part of a URI.

对于POST请求,键值对作为内容数据而不是URI的一部分发送。

#2


1  

Since the parameter you are attempting to pass null to is supposed to represent a key-value pair of data you want to pass to the url you are posting to, it probably makes alot more sense to use an empty object ({}) that null.

由于您尝试传递null的参数应该表示要传递给您要发布到的URL的键值对数据,因此使用空对象({})可能会更有意义。

null isn't treated the same way as you might expect it would be if you are thinking of a language such as Java.

如果您考虑使用Java等语言,则不会像处理预期的那样对待null。

#3


0  

try $.ajajx with th e method "POST" , will be better

用“POST”方法尝试$ .ajajx,会更好

#1


6  

Try $.get() for query-string requests:

尝试$ .get()查询字符串请求:

$.get('complexitybar.ashx?a=init&vc=...')

POST requests expect the URL and key-value pairs to be seperate:

POST请求期望URL和键值对是分开的:

$.post('complexitybar.ashx', 'a=init&vc=...')

With POST requests, the key-value pairs are sent as content data rather than as part of a URI.

对于POST请求,键值对作为内容数据而不是URI的一部分发送。

#2


1  

Since the parameter you are attempting to pass null to is supposed to represent a key-value pair of data you want to pass to the url you are posting to, it probably makes alot more sense to use an empty object ({}) that null.

由于您尝试传递null的参数应该表示要传递给您要发布到的URL的键值对数据,因此使用空对象({})可能会更有意义。

null isn't treated the same way as you might expect it would be if you are thinking of a language such as Java.

如果您考虑使用Java等语言,则不会像处理预期的那样对待null。

#3


0  

try $.ajajx with th e method "POST" , will be better

用“POST”方法尝试$ .ajajx,会更好