缓存在我的小工具中,如何将其删除? [英] Cache in my gadget, how delete it?
问题描述
大家好!
我的名字叫KỳNguyễn,我来自越南,我有一个问题想问您我的申请.能帮我吗?
我在做一个小工具,当系统在屏幕上启动时,它将显示我公司的新员工.
但我不知道为什么我的小工具具有缓存,因此xmlhttp对象返回失败值,它在系统中返回旧值,您可以看到以下内容:
hello everybody!
My name is Kỳ Nguyễn, I come from VietNam, and I having a problem want to ask you for my application.Can you help me, please?
I doing a gadget, it will display new job of staff in my company when system start on screen.
but I don''t know why my gadget have cache, so xmlhttp Object return fail value, it return old value in system, You can see following:
this.xmlHttp = CreateXmlHttpRequestObject();
searchTags = System.Gadget.Settings.read("Tags");
if (searchTags=='') {
searchTags="admin";
}
this.xmlHttp.open("GET", "http:localhost/gadget/GetData?value=" + searchTags,false);
this.xmlHttp.setRequestHeader("Cache-Control","no-cache"); //(*)
this.xmlHttp.send();
var temp = eval("(" + this.xmlHttp.responseText + ")");
job.innerHTML = temp.d;
我已经调试,看到它运行到(*),但是this.xmlHttp.send()
返回了旧值.
I have debugged, see it run true to (*), but this.xmlHttp.send()
return old value.
Can you help me this error, Please?
推荐答案
我不确定您的问题,是否因为相同的搜索标签得到的结果相同?
无论如何,在AJAX中,我通常通过在我的http请求中添加时间戳作为伪查询参数来解决缓存问题,也可以尝试如下操作:
I am not sure about your problem, is it that you getting same result for same search tag?
Anyways, in AJAX i generally fix the caching problem by adding a timestamp as a fake query parameter in my http request, you can also try something like below:
<br />
var currentTime = new Date();<br />
this.xmlHttp.open("GET", "http:localhost/gadget/GetData?time="+currentTime.getTime()+"&value=" + searchTags,false);<br />
这会有所不同.每次都要求.
看看是否适合您.
this will diff. request every time.
see if that works for you.
感谢saxenaabhi6!
非常感谢,那时我的程序正在运行,谢谢!嗨.
Thank saxenaabhi6!
thanks a lot, my program was running then, thanks you more! Hi.
这篇关于缓存在我的小工具中,如何将其删除?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!