0

im experimenting locally with jQuery and its load() function. I have this JS code:

$(document).ready(function(){
  $("img.menu").click(function(){
    $("div#content").load("about.html");
  });
});

It references to

<td><img id="toolbar" class="menu" src="toolbar/about.png" /></td>

and its supposed to load the about.html file that its on the same folder:

<p>some text...</p>

And it should get loaded at:

<div id="content">
<p>Content</p>
</div>

Im following this tutorial

I dont know what im doing wrong but it doesnt get displayed. Im using jQuery-1.8.0 btw EDIT: Im following this code model too, but with html files like the other tutorial

4

2 回答 2

1

You might not be running a server.. Remember that theses calls needs a server to run on. Wamp will do. If not try consoling.

于 2012-09-08T04:47:34.820 回答
0

try this one instead of load

$(document).ready(function(){
  $("img.menu").click(function(){
    $.get('about.html', function (data) {
         $("div#content").html(data);
    });
  });
});
于 2012-09-08T04:49:02.127 回答