我得到了错误:
请求失败:URI 太长(超过 8190)
我已经在 StackOverflow 上看到了与此相关的其他帖子。这些帖子推荐:
- 不更改 Apache 设置(同意)
- 使用post,而不是get
- 不在帖子中使用
jsonp
我正在使用 jQuery 的 AJAX 来发布:
$.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);}
});
老实说,我认为这是自动的,但由于您的网址太长,值得一试。
关于php - 在 JQuery AJAX POST 上...请求失败 : URI too long (longer than 8190),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8542061/