XMLHtt prequest setRequestHeader错误 [英] XMLHttpRequest setRequestHeader Error
本文介绍了XMLHtt prequest setRequestHeader错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
IE 9开发者工具说未指定的错误。在这条线的code:
IE 9 developer tools say "Unspecified error." at this line of code:
xmlhttp.setRequestHeader ("If-Modified-Since", "Sat 1 Jan 2005 00:00:00 GMT");
我试图禁用Ajax请求的高速缓存和我没有对服务器的控制,我不能附加一个唯一的ID为每个请求的结束,所以这看起来像我唯一的选择。任何想法,为什么JavaScript不喜欢呢?
I am trying to disable caching of Ajax requests and I don't have control over the server and I cannot append a unique ID to the end of each request, so this looks like my only option. Any ideas why Javascript doesn't like it?
推荐答案
我在调用此之前 xmlhttp.open(...);
。那是错误的。修改标题打开请求后,但在此之前你送吧。
I was calling this before xmlhttp.open (...);
. That was the mistake. Modify the header after you open the request, but before you send it.
xmlhttp.open (...);
xmlhttp.setRequestHeader ("...", "...");
xmlhttp.send ();
这篇关于XMLHtt prequest setRequestHeader错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文