As I attempt to call the following functions in succession, their return does not always happen in the expected order.
Upon discovering asynchronous functions and the concept of using "callbacks," I realized there might be a solution for executing these functions sequentially.
Is there a way to ensure that these functions run in sequence by utilizing callbacks?
$.getJSON('http://localhost/search_data.php?title='+title+'&run=annotations&jsoncallback=?', function(r1){
$.each(make_all_titles3(r1), function (i,v) {
$vpl.append(v);
});
});
$.getJSON('http://localhost/search_data.php?title='+title+'&run=Link&jsoncallback=?', function(r2){
$.each(make_all_titles3(r2), function (i,v) {
$vpl.append(v);
});
});
$.getJSON('http://localhost/search_data.php?title='+title+'&user='+user+'&run=bookmarks&jsoncallback=?', function(r3){
$.each(make_all_titles3(r3), function (i,v) {
$vpl.append(v);
});
});
$vpl.append('<div>Related Terms</div>');
$.getJSON('http://localhost/context-search.php?title='+title+'&jsoncallback=?', function(r4){
$.each(make_all_titles3(r4), function (i,v) {
$vpl.append(v);
});
});