I am trying to create an auto-refresh for a table using ajax/jquery, php/html, and Drupal 6.
Code once the database insert has finished and was successful:
echo "<script type='text/javascript'>autoRefresh()</script>";
Code for the link that eventually calls the javascript code that actually performs the refresh of the table:
$block_content .= "<br><a id='refreshItemId' class='refreshItemLink' href='$host_url/refresh/projectitems/gid/$curr_gid/nid/$curr_nid'>Refresh List</a>";
Javascript code that is added to the page using PHP (I know it could be a javascript file and then include that, but that's for another day). This is the code I added to attempt to automatically make click() the link created above once a form is submitted and the item was successfully added to the database:
$block_content .= "<script type='text/javascript'>
function autoRefresh()
{
alert('Auto Refresh');
//document.getElementById('refreshItemId').click();
}
</script>";
I thought this would have worked, but the autoRefresh() JS function never gets called. Any ideas?