用JS的数组缓存一些东西
var cache_index = new Array(); //首页的ajax缓存 //ajax 推荐的游戏和软件 function change_tuijian(sid,div_class){ if(typeof(cache_index[sid])=="undefined") { $.post(APP_PATH + "index.php?m=game&c=index&a=tui_ajax", {sid: sid}, function (data) { var tmp_str = ''; eval("var obj=" + data); for (var v in obj) { tmp_str += '<div class="each">'; tmp_str += '<a hidefocus="true" onclick="display_show(\'' + APP_PATH + 'html/game/' + obj[v]['catid'] + '/' + obj[v]['id'] + '.html\')" class="thumb father_cover">'; tmp_str += '<img src="' + obj[v]['thumb'] + '" />'; tmp_str += '<span class="cover cover67"></span></a><div class="wenzi">'; tmp_str += '<h5><a hidefocus="true" href="javascript:void(0);" onclick="display_show(\'' + APP_PATH + 'html/game/' + obj[v]['catid'] + '/' + obj[v]['id'] + '.html\')">' + obj[v]['title'] + '</a></h5>'; tmp_str += '<p>' + obj[v]['version'] + ' | ' + obj[v]['filesize'] + '</p>'; tmp_str += '<a hidefocus="true" id="' + remove_k(obj[v]['bundleId']) + '" iid="apple_' + obj[v]['id'] + '" ititle="' + obj[v]['title'] + '" href="javascript:void(0);" class="a1 toload">下载</a>'; tmp_str += '</div></div>'; } tmp_str += '<script type="text/javascript" src="' + APP_PATH + 'statics/js/game/list_again.js"></script>'; cache_index[sid] = tmp_str; $(div_class).html(tmp_str); reset_status(); }) }else{ var tmp_str = cache_index[sid]; $(div_class).html(tmp_str); reset_status(); } }