Reputation: 403
I am sending a GET
request via $.getJSON
, and the data sent is really big. I need to get a result after the processing of my data, so POST
ing it instead doesn't seem to be a solution. Any idea? The data sent is a string encoded as a json. I thought about sending it without encoding it first, as an array, but then my response will be only "Array", so there is no way of decoding it afterwards.
Upvotes: 0
Views: 5022
Reputation: 1931
use $.ajax
this way:
$.ajax({
dataType: "json",
type:'POST',
url: url,
data: data,
success: function(response){...}
});
afterall $.getJSON
its just a wrapper of $.ajax
Upvotes: 1
Reputation: 943564
If you need to send so much data that it exceeds the limit on URL length, then you either have to find some way to express that data in fewer characters or you have to use POST. So you have to use XHR.
I need to get a result after the processing of my data, so POSTing it instead doesn't seem to be a solution.
Using POST should not be a barrier that that.
If you are depending on JSON-P for a cross-domain request then you will have to use some alternative means to bypass the same origin policy such as a CORS of a proxy.
Upvotes: 0