On JQuery AJAX POST...request failed: URI too long (longer than 8190)
You should try setting proccessData to false.
From the docs:
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.
so to prevent the data being added to the url:
$.ajax({
url: "test.php",
dataType: "application/json",
data: paras,
type: "POST",
proccessData: false, // this is true by default
success: function(ret){callback(ret);}
});
Honestly, I thought this was automatic, but since your url is too long it's worth a shot.
Kyle Cureau
Currently building crone.ai and hakeema. Reach me on Twitter
Updated on June 04, 2022Comments
-
Kyle Cureau almost 2 years
I got the error:
request failed: URI too long (longer than 8190)
I've seen other posts on StackOverflow for this one. Those posts recommend:
- Not changing Apache settings (agree)
- Using post, not get
- Not using
jsonp
with post
I'm using jQuery's AJAX to POST:
$.ajax({ url: "test.php", dataType: "json", data: paras, type: "POST", success: function(ret){callback(ret);} });
It's my impression you can use json just not jsonp. Correct? If so, why might I still be getting the error?