The AJAX request for jquery is the default request cache is true, which is turned on, and defaults to False when datatype is script and JSONP. Now I want to read the cache in the browser, because the AJAX request data is very large, request once is enough. But the problem is, in FF, there is no Ajax cache, that is, each time the AJAX request will be triggered, this is not the same as IE. So here's the thing to be aware of, to make a judgment that prevents the Ajax event from triggering.
Copy Code code as follows:
function Ajax_show (apartid,roomclass,sorttile) {
Hx_this_fangxing_num=sorttile;
Huxing_pic_set_color ();
var this_li=$ (' #title_ ' +sorttile);
var cache=this_li.data ("cache");
if (Undefined!=cache) {
var Data_arr =cache.split ('-');
xg_pic_links=data_arr[0];//Cache Record
LAYOUT_PIC_LINKS=DATA_ARR[1];
LAYOUT_BIG_PIC_LINKS=DATA_ARR[2];
PRODUCT_LINKS=DATA_ARR[3];
Xg_pic_deal_array ();
Xg_show_pic (xg_now_pic_id);
}else{
$.ajax ({///JQ cached cache under FF or a new request will be initiated
Type: "POST",
URL: "Index.php?m=content&c=index&a=ajax_all_pic",
Data: "Apartid=123&roomclass=123",
DataType: ' Text ',
Success:function (backdata) {
This_li.data (' cache ', backdata);/cache Record
var Data_arr =backdata.split ('-');
XG_PIC_LINKS=DATA_ARR[0];
LAYOUT_PIC_LINKS=DATA_ARR[1];
LAYOUT_BIG_PIC_LINKS=DATA_ARR[2];
PRODUCT_LINKS=DATA_ARR[3];
Xg_pic_deal_array ();
Xg_show_pic (xg_now_pic_id);
}
});
}
}
Mark by This_li.data (' cache ', backdata)//cache record