在我的项目中,我有一个启动js函数的php文件进行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调用?
提前致谢
答案 0 :(得分:1)
我建议以下流程:
容易!