I have a JavaScript function that makes two consecutive Ajax requests using jQuery. I want to make sure that the first request has loaded before the second function is call
$.post("script1.php", {data:"val"}, function(response) {
$.post("script2.php", {data:response}, function(results) {
// this second call will be initialized when the first finishes
});
});