0
$("#page").ajaxStart(function(){
   $("#loading").show();
}); 
$('#page').load('target.html', function() {
    $("#loading").hide();
}

This is how I load my target page, but this AJAX function only loads scripts, not all nodes inside it. How to load a page with all its nodes, like images, etc. Is it possible?

The page loads but images in it starts loading way after. What I need is to load the elements inside it just like a swf movie.

sirmdawg
  • 2,579
  • 3
  • 21
  • 32
Recep Şimşek
  • 569
  • 7
  • 16
  • Can you show us what target.html looks like ? it should only contain the content for #page (ie not `` or ``) – Manse Dec 06 '11 at 16:11
  • no,there are no html or head tags.Please check my comment at the following response you will get what i mean. – Recep Şimşek Dec 06 '11 at 16:19

1 Answers1

0

First off, you're missing a closing ");" so i've added that...

$("#page").ajaxStart(function(){
   $("#loading").show();
}); 
$('#page').load('target.html', function() {
   $("#loading").hide();
});

Does this fix the problem? .load should load the whole page. Check if there are issues with your target.html page.

If you're trying to load all the images before you show the page or something, check this:

jquery event once all images are loaded (including cached images)?

Community
  • 1
  • 1
sirmdawg
  • 2,579
  • 3
  • 21
  • 32