views:

485

answers:

2

Hello,

I'm trying to load an external document using jQuery, $.load call. It seems to work in IE6, IE8 and Firefox 3.5, but it doesn't work in Opera and Webkit browsers (Chrome and Epiphany)... all of them report (in their developer consoles) that they load external document successfully, but they don't show its content.

Test case is here: http://artenis.kirc.pl/jShow-hei6Heix/ (it should show 'Works!').

I guess I am missing something trivial here; I googled a bit but found nothing.

+1  A: 

Looks like you're not waiting for $(document).ready() to me, unless I'm missing something.

$(document).ready(function(){
  var basedir = $("meta[name=basedir]").attr("content");

  function loadslides() {
    $("#presentation").load(basedir+"/slides.html .slide");
  };

  loadslides();
});
ceejayoz
That was it, thanks!
liori
A: 

I have the same problem.. works in FF, Safari but not chrome.

     <script>
        //when document loads
         $(document).ready(function() {

             //navigation item is clicked
            $('.nav_item').click(function() {

             //get the clicked nav items id
             var nav_item = $(this).attr("id");
             var location_to_load = nav_item;

             //load content
            $('#sliding_content_container').load(location_to_load + '.html');

            //dont refresh
            return false;
            }); 
         });
        </script>
smoop
Then ask a proper question. This is not a discussion forum. And you definitelly don't have the same problem, because you *are* waiting for .ready().
liori
sorry about that. I found that using IIs for chrome it will work, it will work hosted as well. I had the same problem with chrome not working with the .load but it seems chrome needs to be in the right environment not running raw.
smoop