Java:Ajax的内容也会被缓存吗?
<script type="text/javascript">
$(document).ready(function() {
$("#pb1").progressBar();
});
function ajax() {
$.ajax({
type : 'GET',
url : "servlet/Test",
dataType : 'text',
async : true,
success : function(response) {
alert(response);
$("#pb1").progressBar(response);
},
error : function(xhr, r, e) {
alert(xhr + "," + r + "," + e);
}
});
}
</script>
通过ajax获取后台返回的代码
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
PrintWriter out;
try {
out = response.getWriter();
out.write("75");
out.close();
} catch (IOException e) {
e.printStackTrace();
}
}
后台是一个简单的Servlet的doGet方法
现在我部署项目,启动tomcat,第一次请求时正常,返回的75,此时我将75改成40,然后再次请求,还是返回的75...然后我在想这东西是不是会被浏览器缓存呢?=。=于是我从Chrome换成了Firefox,还是返回75,真是活见鬼了....Ajax会一直返回第一次返回的值吗?
HandJob
10 years, 8 months ago