I believe I am timing out a web service by making too many calls in a short period of time. I am wanting to wait about 5 seconds between each iteration of a $.each
loop in my jquery.
Here is a look at what I have:
function submitMyList(myList) {
$.each(JSON.parse(myList), function (key, value) {
setTimeout( function(){
$.ajax({
type: 'POST',
url: '@Url.Action("submitMyList", "myController")',
dataType: 'html',
contentType: 'application/json; charset=utf-8',
data: JSON.stringify(//passing my values),
success: function (result) {
//success code
},
error: function (result) {
//error code
},
complete: function () {
//completion code
}
});
}, 5000)
});
}
This still is execution extremely quick, one after another.