本文介绍了刷新后如何保持ajax加载!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好!再次在这里有一个小问题!

我会直截了当!!

Hello everyone!! here again with a little problem!!

I will straightly go the point!!

<html>
<head>
<script type="text/javascript">
function loadXMLDoc()
{
	var xmlhttp;
	if (window.XMLHttpRequest)
	  {// code for IE7+, Firefox, Chrome, Opera, Safari
	  xmlhttp=new XMLHttpRequest();
	  }
	else
	  {// code for IE6, IE5
	  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	  }
	xmlhttp.onreadystatechange=function()
	  {
	  if (xmlhttp.readyState==4 && xmlhttp.status==200)
		{
		document.getElementById("test").innerHTML=xmlhttp.responseText;
		}
	  }
	xmlhttp.open("GET","info.php",true);
	xmlhttp.send();

}
</script>

</head>

<body>

<div id="test"><h2>This is where the new text will be displayed</h2></div>
<button type="button"  önClick="loadXMLDoc()">Change Content</button>


</body>
</html>


这是我在同一目录中的info.php文件!


And here is my info.php file in the same directory!!

echo "tarek";
?>


现在的问题是,当我单击按钮div会将我的结果更改为该PHP文件时,一切工作正常.但是,当我刷新页面时,它会返回到原始阶段!

刷新后,我想将其保存到info.php文件中.


Now the thing is that Everything is working fine when I click on the button the div is changing my result to that PHP file. But when I refresh the page it goes back in the original phase!!

I want to keep it to the info.php file after refresh!!!

推荐答案



这篇关于刷新后如何保持ajax加载!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-26 22:09
查看更多