javascript数据缓存

if(!self.hotCityPrice[city]) {
                $.ajax({
                    type: 'GET',
                    url: self.hotCityUrl,
                    data: {cityCode: city, t: new Date().getTime()},
                    success: function(res) {
                        if(res.bstatus.code == 0) {
                            try {
                                self.insertPriceListHtml(res.data.carTypes);
                                self.hotCityPrice[city] = res.data.carTypes;
                            } catch(e) {
                            }
                        } else {
                            alert(res.bstatus.des);
                        }
                      }
                });
            } else {
                self.insertPriceListHtml(self.hotCityPrice[city]);
            }

 

posted @ 2015-09-15 17:22  darr  阅读(430)  评论(0编辑  收藏  举报