jquery .load function not setting dom element
Hi All,
I can't for the life of me figure out how to do this so any help would be much appreciated.
What I am trying to do is use the .load function to call a php file that ultimately results in the deletion of a record from a database. The php file outputs true or false as to the success or failure of the deletion.
This output is assigned to an html element. I then try to access the text/html set so that I can output a prompt to the user letting them know if the deletion was successfull. If it was successfull I reload the table thus removing the deleted row.
The issue is that the dom does not seem to be updating quick enough for the text value loaded to be accessible by my lines of code immediately after the load code.
// load result into dummy page element
$('#loaddummy').load("dns_functionsNew.inc.php",{FunctionCall: 'dns_DeleteRecord', domain: $('#domainname').val(), recordtype:del_recordtype, data:del_data, zoneid:$('#zoneid').val()}).insertAfter();
// access page element and use loaded text to determine if
// deletion ok
if($('#loaddummy').text() == 'ok')
{
var outputText = '<h3>'+del_recordtype+' deletion successfull</h3>';
}
I know the dummy element text is being set because if I look at the source it has been set.
Please help
Kevin