i want to start a function after a successful ajax call. What i do now is this
function ajaxCall(url, types, next) {
$.ajax({
url: url,
type: 'POST',
beforeSend: function () {
$("#plaatsMelding").append("<div id=\"" + types + "verwerkt\"><div class=\"progress-label\">" + types + " verwerken...</div></div>");
},
success: function (data) {
$('#plaatsMelding').empty();
$("#plaatsMelding").append("<div id=\"" + types + "verwerkt\"><div class=\"progress-label\">" + data + "</div></div>");
//run next script
if (next.length) {
alert(next);
next(); //this won't work because it will search for the next() function
}
}
});
}
i start this function with this function:
function saveRace() {
ajaxCall("verwerkRace.php", "race", "savePlayers");
}
so when that function is ready i want it to run the function "savePlayers". How can i do this?
function savePlayers() {
ajaxCall("verwerkPlayers.php", "players");
}