Can’t get the GrabOldMessages() function to run after the html() runs. Below is my code. Using jQuery version 1.7.2, I think I’m calling it back correctly, am I overlooking something? Please help me find my mistake. If you need me to provide anymore info, just let me know. Thank you for taking the time to help me.
//GRAB NEW MESSAGES
function GrabNewMessages(){
var doIB = encodeURIComponent("GET_DATA");
$.ajax({
type: 'POST', url: 'app/pull_data_files/inbox_NM_array.php', dataType: "json", data: { getInbox: doIB },
success: function(inbox_NM_data) {
if(inbox_NM_data[1] == 'true'){$('#inbox_NMlist_html').html(inbox_NM_data[0], function(){ GrabOldMessages(); });}
else{alert("Didn't work");}
}
});
return false;
}
//GRAB OLD MESSAGES
function GrabOldMessages(){
var doIB = encodeURIComponent("GET_DATA");
$.ajax({
type: 'POST', url: 'app/pull_data_files/inbox_OM_array.php', dataType: "json", data: { getInbox: doIB },
success: function(inbox_OM_data) {
if(inbox_OM_data[1] == 'true'){$('#inbox_OMlist_html').html(inbox_OM_data[0], function(){GoToInbox();});}
else{alert("Didn't work");}
}
});
return false;
}
You are specifying a second parameter in
html()which takes either none or one.Try using this success version instead for your first code-snippet.
And this for the second code-snippet: