spring mvc - JQuery ajax error for large response -
i using spring-mvc , jquery ajax. ajax function is
jquery("#usersearch").click(function () { jquery("body").addclass("loading"); var formvalues = jquery('#user-search').find(':input[value][value!=""]').serialize(); jquery.ajax({ type: "get", url: "/samplewebservice/sample/user-byname", data: formvalues, datatype: 'json', timeout: 600000, success: function (data) { jquery('#json').val(json.stringify(data)).trigger('change'); jquery('body').removeclass("loading"); }, error: function (e) { alert('error while request..' + e); jquery('body').removeclass("loading"); } }); });
what issue returned json string server. goes error function when response large checked through firebug returns correct response. , 1 more point if response content less means has no problem. when exceeds has problem. in firebug response tab says open in new window see response when response more
i don't have server side issue because correct json printed in both server console , browser console having large data issue.
there problem json format returned server. figured out using following error function
jquery("#usersearch").click(function () { jquery("body").addclass("loading"); var formvalues = jquery('#user-search').find(':input[value][value!=""]').serialize(); jquery.ajax({ type: "get", url: "/samplewebservice/sample/user-byname", data: formvalues, datatype: 'json', timeout: 600000, success: function (data) { jquery('#json').val(json.stringify(data)).trigger('change'); jquery('body').removeclass("loading"); }, error: function (jqxhr, textstatus, errorthrown) { alert('error status: ' + textstatus); alert('error message: ' + errorthrown); jquery('body').removeclass("loading"); } }); });
Comments
Post a Comment