![](/img/trans.png)
[英]prevent a function running multiple times after calling it again from ajax
[英]Cache the results from the ajax calls to prevent running them multiple times
在我的项目中,我有一个php文件,该文件启动js函数以进行ajax调用。 我的问题是,如果用户刷新浏览器功能上的php页面,请重新进行ajax调用,等等。 我需要缓存ajax执行的第一个结果,以便在刷新完成后使用缓存中的数据,而不是再次进行ajax调用。
我的电话是
if (xmlHttp)
{
// try to connect to the server
try
{
xmlHttp.open("GET", "top10.php?P1="+oStxt, true);
xmlHttp.onreadystatechange = handleRequestStateChange10;
xmlHttp.send(null);
}
// display the error in case of failure
catch (e)
{
alert("Can't connect to server:\n" + e.toString());
}
如何防止浏览器页面刷新多个Ajax调用?
提前致谢
我建议以下流程:
简单!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.