Ajax请求使用
Cache的作用:第一次请求完毕之后,如果再次去请求,可以直接从缓存里面读取而不是再到服务器端读取;
参数类型:Boolean类型的参数,默认为true(当dataType为script时,默认为false),设置为false将不会从浏览器缓存中加载请求信息;false的话会在url后面加一个时间缀,让它跑到服务器获取结果;cache只有GET方式的时候有效;
true的话会读缓存;
实例:jQuery.Ajax({
type:"GET",
async:false,
url:selectPageDataUrl,
data:"rowsPerPage="+rowsPerPage+"&pageNo="+pageNo+"&seleCondi="+seleCondi,//
dataType:"json",
cache:false,
error:function(XMLHttpRequest,textStatus,errorThrown){ alert("读取数据失败,请尝试重新刷新页面");
},
success:function(odata){
Alert(“返回结果:”+odata);
}
});
|
|