Jquery .load() not working in IE
I use jquerys .load() function on a webpage. It loads a loader.gif file and then a html document into a specific di开发者_运维问答v. It works in FF, Chrome and Safari but not in IE. I've been searching the web and stll not found an answer to this so I wonder if you can help me. This is my jquery:
$(document).ready(function() {
$('.loadCat').click(function(e) {
var url = $(this).attr("href");
$('#target').html('loading...');
$('#target').load(this.href);
e.preventDefault();
return false;
});
});
EDIT: This is an example of the html i use:
<a href="page.php" class="loadCat">Link</a>
When you click the link in IE the loading... appears but not the page.php im trying to load.
Try this:
$(function(){
$('.loadCat').click(function(){
var
targetElement = $("#target"),
url = this.href + "?" + new Date().getTime(); //To prevent IE caching
targetElement.html('loading...');
$.get(url, function(data){
targetElement.html(data);
});
return false;
});
});
Edited...
精彩评论