// Ajax缓存 请求一次,页面不会在次访问这个方法,会读取缓存数据$(".routeTips").live("mouseenter",function () { var $this = $(this); var billcode = $(this).attr("data-sitecode"); var key = "A027" + billcode; if (isCache) { if (cacheRouteTips[key]) { $this.manhua_bubbletips({ position: "t", value: 35, content: cacheRouteTips[key] + "", last: true }); } else { if (req) { req.abort(); } postData(); } }else { postData(); } function postData() { req = $.ajax({ type: "post", dataType: "json", url: "/postdate.aspx", data: "id=" + billcode + "&type=A018", cache: false, timeout: 20000, success: function (msg) { if (msg.Result[0]["status"] == "true") { $this.manhua_bubbletips({ position: "t", value: 35, content: msg.Result[0]["site"] + msg.Result[0]["tel"] + "", last: true }); cacheRouteTips[key] = msg.Result[0]["site"] + msg.Result[0]["tel"]; } } }); }});
时间: 2024-08-25 14:08:36