Solution on "HTTP Error 414 Request URI too long" error using getJSON

The explanation of 414 error is described here:
http://support.microsoft.com/kb/248061

With regard to JSON queries with jQuery this basically means we are not able to use long GET parameters. But for sure this is necessary for sending bigger objects serialized as JSON.
The solution would be using POST requests, but is jQuery support that?

The answer is yes if we just extend jQuery with post requests as it is described in jQuery forum:
http://forum.jquery.com/topic/getjson-using-post

jQuery.extend({
postJSON: function( url, data, callback) {
return jQuery.post(url, data, callback, "json");
}
});

Then just replace getJSON with postJSON where it is needed.

No comments:

Post a Comment