Here’s my script. I want the result to be cached but it keeps sending requested requests if my mouse enters it again.
$('.poplist li').mouseenter(function(){
t=$(this).parent().attr("rel");
i=$(this).attr("rel");
$.ajax({
url:"/j/place",
data:{"t":t,"tid":i},
cache:true,
success:function(data){
data= jQuery.parseJSON(data);
s=$('.left[rel='+t+']');
s.find('.intro').html(data["intro"]);
s.find('.shop-avat img').attr("src","http://img.douban.com/u/plao/"+data['img']);
}
})
})
jQuery.ajax’s
cacheoption does nothing when set totrue, and caching is entirely left up to the browser. If it is set tofalse, however, a cache-busting timestamp is appended to the request. That’s all.Update:
To see that this is so, take a look at the the source of jQuery.ajax, version 1.6.4, line 676, here: https://github.com/jquery/jquery/blob/1.6.4/src/ajax.js#L676