troubleshooting Question

jQuery dialog shows dynamic content in IE8 once, then does not refresh upon dialog or page reload?

Avatar of evibesmusic
evibesmusicFlag for United States of America asked on
4 Comments2 Solutions1072 ViewsLast Modified:

I've created a link on my page which opens a jQuery dialog. Within this dialog is a simple form which has one textarea and a submit button.

Content from the DB is placed into the textarea so that it can be edited. When the form is submitted, the DB is updated and the page is refreshed.

In all other browsers except IE8, the dialog pulls the latest data from the DB each time the dialog is opened regardless if the form was submitted and the page was refreshed.

In IE8, when the dialog  is opened the first time, it queries the DB and shows the information as expected. If the dialog is closed and then reopened again, it doesn't fetch the latest results from the DB, it simply shows the same information again.

This happens even if the page is refreshed because the user submitted the form?

In my jQuery code there is code to empty the dialog so I am not sure why IE8 differs from other browsers (FF, Safari, etc.)?

Here's my jQuery code:
	$(function() {         
		  $(".modal_link").click(function(e) {
				var url = $(this).attr("href");
			    var mytitle = $(this).attr("title");
				$("#dialog").load(url,null,function() {
						    title: mytitle,
							modal: true,
							close: function(event, ui) {
							$("#dialog").empty(); // remove the content 
							}//END CLOSE
					  });//END DIALOG
				});//END DIALOG

Open in new window

Here is a sample link which opens the jQuery dialog:
echo'<a class="modal_link" title="'.$edit_result['project_title'].' - Progress Notes" href="../scripts/a3_dialog_content.php?cmd=notes&a3_id='.$edit_result['id'].'">';

Open in new window

Here is my PHP code which creates the dialog content:
	$a3_id = $_GET['a3_id'];
	$notes_sql = "SELECT * FROM a3_progress_notes WHERE a3_id='".$a3_id."'";
	$notes_query = mysql_query($notes_sql) or die ("Could not run query: " . $notes_sql . "<br />\n" . mysql_error () );
	$notes = mysql_fetch_array($notes_query);
	echo'<form action="'.$_SERVER['PHP_SELF'].'?cmd=update_notes&a3_id='.$a3_id.'" method="post" name="update_notes">';
		echo'<textarea name="notes" class="search_box" style="width:96%; min-height:100px;">'.$notes['notes'].'</textarea>';
			echo'<div style="float:left; padding-top:10px;">';
				echo'<span style="font-variant:small-caps">Last Updated: '.date('m-d-Y @ g:i A',strtotime($notes['updated_on'])).'</span>';
			echo'<div style="float:right;">';
			echo'<input type="image" src="../images/save.png" title="Save" style="margin-top:10px;" height="30px" width="30px" />';
		echo'<input type="hidden" value="'.$a3_id.'" name="a3_id" />';

Open in new window

Join our community to see this answer!
Unlock 2 Answers and 4 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros