Advertisement
Guest User

Artistan/jQuery ajax requests locking IE8

a guest
Jun 21st, 2010
233
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     <script type="text/javascript">
  2.     ///////////////// Data icon INFO //////////////////////
  3.     // /members/dataicon_ajx.php?login=cyberlot&item=1008CS-100E_TSG
  4.     $(function(){
  5.             $.ajaxSetup({
  6.               timeout: 20000,
  7.               async: true
  8.             });
  9.             // store whether we are searching for this one yet or not. CACHE
  10.             var cache={};
  11.             var delim_cache = '|||'
  12.            
  13.             // apply the search results. (callback for ajax)
  14.             cache_ds = function(jsondata,status,xmlReq){
  15.                 $.each(jsondata, function(itemno,data) {
  16.                   //console.log(itemno,data);
  17.                   show_icon(data);
  18.                 });
  19.                 //console.log(jsondata);
  20.                 return false;
  21.         }
  22.    
  23.             // caching and doing one call to get around the browser limit for # of requests and speed things up
  24.             cache=new Array();
  25.         $('.findthese').each(
  26.                 // update the findthese item numbers
  27.                 function(index,domEle){
  28.                     var $this = $(domEle);
  29.                     var st = typeof(cache[$this.html()]);
  30.                     if(st == 'undefined'){
  31.                         cache.push($this.html());
  32.                     }
  33.                 }
  34.             );
  35.             cache = $(cache).get().join(delim_cache);
  36.             //console.log(cache);
  37.            
  38.             // post all the items to get additional info.
  39.             $.post("dataicon_ajx.php", { name: "{{$login}}", items: cache , delim: delim_cache, ac:'items' },cache_ds,'json');
  40.     });
  41.    
  42.         function show_icon(data){
  43.             if(data.itemNumber){
  44.             console.log('Icon it',data.itemNumber);
  45.                 // update the findthese icons
  46.                 $('.findthese').each(
  47.                     function(index,domEle){
  48.                         try{
  49.                             var $this = $(domEle);
  50.                             if($this.html() == data.itemNumber){
  51.                                 // clear the temp data
  52.                                 // make findthese Icon show if needed.$this.html('');
  53.                                 if(data.pbFree_findthese=='Yes'){
  54.                                     $this.addClass('findthese_active');
  55.                                     //alert('Icon On '+data.itemNumber);
  56.                                     $this.html('').removeClass('findthese');
  57.                                 }
  58.                                 // if active, update the link directly to data icon.
  59.                                 if(data.active=='1' && data.data_icon!=''){
  60.                                     var parent = $this.parent();
  61.                                     parent.attr('href',data.data_icon);
  62.                                 }
  63.                             }
  64.                         } catch(e) {
  65.                             //console.log(e);
  66.                         }
  67.                     }
  68.                 );
  69.             }
  70.     }
  71.     </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement