Jquery 缓存页面AJAX不工作
无论何时在Firefox和Webkit中缓存页面,都会丢失所有ajax功能Jquery 缓存页面AJAX不工作,jquery,ajax,caching,manifest,jqtouch,Jquery,Ajax,Caching,Manifest,Jqtouch,无论何时在Firefox和Webkit中缓存页面,都会丢失所有ajax功能 <html manifest=cache.manifest> <head> <script src="js/jquery.js" type="text/javascript"></script> <script src="js/jqtouch.js" type="text/javascript"></script> 还使用jquer
<html manifest=cache.manifest>
<head>
<script src="js/jquery.js" type="text/javascript"></script>
<script src="js/jqtouch.js" type="text/javascript"></script>
还使用jquery$.ajax进行请求。两者都不起作用。
JQuery:
他们总是说successful,但只有在缓存页面时才返回数据。否则返回null“”
最后一件事:我请求的页面不在清单上,因为服务器端后端相当大。不可能在清单中包含所有页面
基本上,我如何访问不在同一站点AJAX清单上的页面。无论我当前何时尝试,它总是返回null。
返回03:11:41,即使没有缓存,等等。这不是真的。如果您明确地从页面请求数据,它会为您重新下载。您可以通过打开Firebug或Chrome的调试窗口来检查这一点,并观察浏览器发出http请求。默认情况下,jquery的ajax函数将显示它接收到的数据(json和jsonp除外)。您可以使用以下命令告诉ajax调用不要缓存:
$.ajax({
cache: false
})
IE中的以下代码进行服务器调用,因为您正在缓存它,而不是进行后续调用
if(navigator.appName == "Microsoft Internet Explorer") {
http = new ActiveXObject("Microsoft.XMLHTTP");
我已经尝试让cache.manifest工作了一段时间,它一直给我类似的响应。我有一个jquery移动应用程序,它使用web服务获取数据,直到我将web服务添加到cache.manifest文件的网络部分后才开始工作
CACHE MANIFEST
# This is a comment.
# Cache manifest version 0.1.3.5
# If you change the version number in this comment,
# the cache manifest is no longer byte-for-byte
# identical.
NETWORK:
# All URLs that start with the following lines
# are whitelisted.
Service.svc
CACHE:
# Additional items to cache.
src/jquery-1.6.2.min.js
src/jstorage.min.js
src/jquery.numeric.js
src/jquery.format-1.1.min.js
assets/json2.min.js
assets/jquery.signaturepad.css
assets/jquery.signaturepad.min.js
jquery.mobile-1.0b2/jquery.mobile-1.0b2.min.css
jquery.mobile-1.0b2/jquery.mobile-1.0b2.min.js
jquery.mobile-1.0b2/images/ajax-loader.png
jquery.mobile-1.0b2/images/icon-search-black.png
jquery.mobile-1.0b2/images/icons-18-black.png
jquery.mobile-1.0b2/images/icons-18-white.png
jquery.mobile-1.0b2/images/icons-36-black.png
jquery.mobile-1.0b2/images/icons-36-white.png
src/link-1-3.js
src/events-1-3.js
src/custom-styles.css
Login.html
我不这么认为,只有服务器到服务器的调用不会再次进行,客户端到服务器的调用应该可以工作。你在做页面级计算吗?你可以给我们更多的细节,比如你的ajax代码调用后端。欢迎使用StackOverflow。我如何明确请求它?@precurson,调用代码是什么,javascript还是服务器端代码…如果javascript你可以打开firebug,.net面板并查看结果。我不明白,您是在使用jquery还是在编写自己的XMLHTTP调用?通常jquery,我只使用XMLHTTP来调试问题,因为我对它比较熟悉。到目前为止,我还没有成功,我的任何代码中都没有提到cache false,但它总是进行调用。??任何输入都不起作用,因为问题是应用程序缓存,而不是常规浏览器缓存。您的建议解决了浏览器缓存问题。我的AJAX URL采用MVC格式:
http://host/Controller/Action/
指定/Action/
或/Action
或/Action/*
不起作用。还有什么我可以试试的吗?
if(navigator.appName == "Microsoft Internet Explorer") {
http = new ActiveXObject("Microsoft.XMLHTTP");
CACHE MANIFEST
# This is a comment.
# Cache manifest version 0.1.3.5
# If you change the version number in this comment,
# the cache manifest is no longer byte-for-byte
# identical.
NETWORK:
# All URLs that start with the following lines
# are whitelisted.
Service.svc
CACHE:
# Additional items to cache.
src/jquery-1.6.2.min.js
src/jstorage.min.js
src/jquery.numeric.js
src/jquery.format-1.1.min.js
assets/json2.min.js
assets/jquery.signaturepad.css
assets/jquery.signaturepad.min.js
jquery.mobile-1.0b2/jquery.mobile-1.0b2.min.css
jquery.mobile-1.0b2/jquery.mobile-1.0b2.min.js
jquery.mobile-1.0b2/images/ajax-loader.png
jquery.mobile-1.0b2/images/icon-search-black.png
jquery.mobile-1.0b2/images/icons-18-black.png
jquery.mobile-1.0b2/images/icons-18-white.png
jquery.mobile-1.0b2/images/icons-36-black.png
jquery.mobile-1.0b2/images/icons-36-white.png
src/link-1-3.js
src/events-1-3.js
src/custom-styles.css
Login.html