Reputation: 445
basically I am trying to load some PHP into a DIV using JS. Using this code:
$('#preview').load("includes/event_image_crop.php?img=" + fname);
However, its not just putting the fname string in there its adding a random string too like this &_=1369168657782
Any ideas?
Thanks
Upvotes: 1
Views: 109
Reputation: 10675
This is a feature designed to prevent caching. It should have no effect on the page (unless you need to use the _
GET variable), but if you need to disable it you should set cache: true
using ajaxSetup
:
$.ajaxSetup ({
cache: true
});
Of course, as Ian mentions, this will affect every Ajax call on the page, so be aware of that if you have other Ajax calls. It might be better to refactor your code and use a more configurable function than .load()
.
See a similar (opposite) question here: Stop jQuery .load response from being cached
Upvotes: 3