$(document).ready(function(){
$("#home_tab").click(function(){
$("#content").hide();
$("#content").load("php/media_body.php");
$("#content")开发者_开发问答.show("slow");
}
});
I'm using the jQuery Ajax library to pull some HTML content from a PHP file on my server. The above code works beautifully in IE and Firefox but, for the love of me, I cannot get it to work in Chrome. Is there something I'm missing?
Thanks,
-Johnny
This pattern may work better for an asynchronous request:
$(document).ready(function(){
$("#home_tab").click(function(){
$("#content").hide().load("php/media_body.php",function(){
$(this).show("slow");
});
});
});
You could use
$.ajax({
type: 'GET',
url:'php/media_body.php',
data: "data=data",
success: function(answer){eval(answer);}
});
Safari and Chrome have client side security feature to prevent phishing. This way is more "secure".
And use an $('#whereToAppend').append() wrapping all the HTML of your file.
精彩评论