i am sending ajax call in a loop. it works fine only for first two iterations and after that throws exception internal server error 500 with description "The JSON request was too large to be serialized" here is code :
<script>
var things = new Array();
var total = 0;
function Load() {
$.ajaxSetup({ cache: true, jsonpCallback: 'quranData' }); // define ajax setup
for (var counter = 1; counter < 4; counter++) {
(function (counter) {
setTimeout(function () {
$.getJSON("http://api.globalquran.com/surah/" + counter + "/quran-simple?jsoncallback=?", {
format: "jsonp"
}, function (Obj) {
$.each(Obj.quran, function (i, by)
{
$.each(by, function (verseNo, line)
{
var obj = new Object();
obj.surah = line.surah;
obj.ayah = line.ayah;
obj.verse = line.verse;
things.push(obj);
total++;
});
});
});
}, counter * 500);
}(counter));
}
return false;
}
server side :
[HttpPost]
public ActionResult DB_Rola(List<thing> things, int count)
{
return Json(new { IsSuccess = true });
}
kindly show me how to deal with it ?