开发者

jquery ajax and google chrome

$(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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜