I want to wait until a current foreach has fully completed before doing the next function, here is the code im using
$(function(){
$.ajax({
url: "/myurl",
dataType: "text",
success: function( data, textStatus, jqXHR ) {
var parsedtext = data.split(',');
$.each(parsedtext, function() {
$("#text").append(this);
});
}
});
});
I have tried adding .done()
to parts of my code but noting has worked, I tried this
$(function(){
$.ajax({
url: "/myurl",
dataType: "text",
success: function( data, textStatus, jqXHR ) {
var parsedtext = data.split(',');
$.each(parsedtext, function() {
$("#text").append(this);
})
.done(function() {
alert('done');
startnewfuction();
});
}
});
});