AJAX not returning updated data

hey everyone, i would appreciate any help you can give me regarding this issue. i have a table displaying data from a table in mysql. i can edit each row in this table. when i click the radio button to edit this field, i am using ajax to display the data in input fields where the user can edit. then when clicking the update button, a php file is called which updates the database and reloads the table with the new updated data. however, if i click on this row again, the ajax is returning the old information and displaying it in the input boxes.

this is the ajax im using:

function getData(typ)
{
xmlHttp=getXMLHTTP()
if (xmlHttp==null)
{
alert (“Browser does not support HTTP Request”)
return
}

	url="admin_fill.php?cid="+typ.value+"&type="+typ.id;
	
	xmlHttp.onreadystatechange=stateChanged
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
	
	document.getElementById("divrb").style.visibility = 'visible';
	document.getElementById("divrb").style.display = 'block';
}

function stateChanged() 
{ 
	var myArray = new Array();
	
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		var myArray = xmlHttp.responseText.split("||");
		
		document.getElementById("id").value 		= myArray[0];
		document.getElementById("title").value 		= myArray[1];
		document.getElementById("link").value 		= myArray[2];
		document.getElementById("ltitle").value 	= myArray[3];
		document.getElementById("desc").value 		= myArray[4];
	} 
}

and this is the php file:

<?php
include ‘db/config.php’;
include ‘db/opendb.php’;

$typ=$_GET['type'];

$unId=$_GET['cid'];

$query = "select * from otherposts where pid = '$unId'";
$result = mysql_query($query) or die(mysql_error());

$row = mysql_fetch_assoc($result);

echo $row['pid'] . "||" .$row['ptitle'] . "||" . $row['plink'] . "||" . $row['plinktitle'] . "||" . $row['pdesc'];

include 'db/closedb.php';

?>

why isnt the new data being displyed when it is being updated correctly in mysql??
HELP!

probably because the web browser is caching the response.

It’s best to be explicit about whether or not a url should be cached by sending an http header to let the browser know that it should not cache the response.


<?php
header('Cache-control: no-cache');
include 'db/config.php';
include 'db/opendb.php';
...

worked just like u said. thanks alot!!