我收到了错误:
请求失败:URI太长(超过8190)
我在StackOverflow上看过其他帖子.这些帖子建议:
>不更改Apache设置(同意)
>使用post,而不是获取
>不使用jsonp与帖子
我正在使用jQuery的AJAX来POST:
$.ajax({
url: "test.PHP",
dataType: "json",
data: paras,
type: "POST",
success: function(ret){callback(ret);}
});
这是我的印象你可以使用json而不是jsonp.正确?如果是这样,为什么我仍然会收到错误?
解决方法:
您应该尝试将proccessData设置为false.
来自文档:
By default, data passed in to the data option as an object
(technically, anything other than a string) will be processed and
transformed into a query string, fitting to the default content-type
“application/x-www-form-urlencoded”. If you want to send a
DOMDocument, or other non-processed data, set this option to false.
所以要防止数据被添加到url:
$.ajax({
url: "test.PHP",
dataType: "application/json",
data: paras,
type: "POST",
proccessData: false, // this is true by default
success: function(ret){callback(ret);}
});
老实说,我认为这是自动的,但由于你的网址太长,所以值得一试.