Iterating with .each through jQuery ajax json is not working in IE -


i'm using following code create divs "random" products. json data received php this:

{"new":[{"product_id":"50",...},...], "best":[{"product_id":"26",...},...], ...} 

"new" products must go <div id="new">, "best" "best" , on.

code:

$.ajax({     url: "/index.php?ajaxrequest&action=5",     datatype: "json",     error: function (xhr, status, errorthrown) {         alert(errorthrown + '\n' + status + '\n' + xhr.statustext);     },      success: function (data) {         $.each(data, function (key, value) {             var new_str = '<ul>';             $(value.sort(function () {                 return 0.5 - math.random()             }).slice(0, 3)).each(function () {                 new_str += '<li><a href="' + this.link + '" class="right_sidebar">';                 new_str += '<img class="right_sidebar_thumb" src="' + this.image + '" alt="' + this.name + '"/></a></li>';             });             new_str += '</ul>';             $('#' + key).append(new_str);         });     } }); 

the problem arises ie. iterates first time, , fills first div, while other browsers work fine.

the problem not in duplicate div ids, , json valid, , jquery gives no errors.

problem resolved! needed turn caching off: cache:false ! everybody!


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -