Johnny Ray
Johnny Ray

Reputation: 51

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

Upvotes: 0

Views: 942

Answers (2)

Siedrix
Siedrix

Reputation: 641

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.

Upvotes: 0

Alex Sexton
Alex Sexton

Reputation: 10451

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"); 
    });
  });
});

Upvotes: 2

Related Questions