Sending data recursively using jquery $.ajax gives stack overflow error..
- by Rosdi
Why am I getting "too much recursion" error when I do the following?
function sendTheNames() {
alert("start submitting names..");
return function (array) {
var name = $(array.shift()).text();
$.ajax({
url: "test.jsp?name=" + name,
complete: function () {
if (array.length > 0) {
return arguments.callee(array);
}
}
});
};
}
$(document).ready(function () {
var selectedNames = [];
$('ul li input:checked').each(function () {
selectedNames.push($(this).parent());
});
alert("begin");
sendTheNames()(selectedNames);
alert("done");
});