Analysis of Ajax caching problems in jquery

Source: Internet
Author: User

  Now I'm going to read the cache in the browser because the AJAX request is large enough to request once. 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.

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. 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.spli T ('-');             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{                   $.aj Ax ({///JQ cache cached under FF or will launch new request                     type: "POST",   & nbsp                url: "Index.php?m=content&c=index&a=ajax_all_pic",                   data: "apartid=123&roomclass=123",                  datatype: ' text ',                   Success:function (backdata) {                       THIS_LI.DA Ta (' cache ', backdata);/cache record                          &NBS P  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);                            &NBSP}     &NB Sp      });            }      {   
Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.