I'm trying to Load HTML from a remote file and inject it into the DOM. I'm using official example from jquery:

Example
jQuery Code

$("#feeds").load("feeds.html");

Before

Result:

45 feeds found.

But the code seems don't work. <? echo $scripts; ?> are in the head of the page, so jquery.js is included, everything should work fine, but it don't work...what should i do?

Comments

somes’s picture

how and where are you calling it

$("#content").fadeIn('slow').load('throbberCircle.html');
works fine for me

timonweb’s picture

i call it in node-content_type.tpl.php this way:

$("#feeds").load("feeds.html");

and this doesn't work :(

dericknwq’s picture

probably you inserted your javascript in front of the

so it may not have been loaded when the script code execute.

try this instead:

$(function () {
  // your codes in here..
  $("#feeds").load("feeds.html");
});

you can find out more at http://docs.jquery.com/Core#.24.28_fn_.29