jquery .load()不起作用

我似乎无法让jquery的.load()函数工作。 必须是简单的我缺少…基本上只是尝试将more.html的片段加载到index.html。

的index.html

     Test  $(document).ready(function () { alert("jquery script executing..."); $('#foo').load('more.html #bar', loadComplete); }); function loadComplete (response, status, xhr) { alert("load complete."); }    
foo foo foo

more.html

     More   
bar bar bar

我看到两个警报 – 正在执行脚本,并且正在调用回调(即负载正在完成)。 但是,内容不要改变。 我尝试过safari,chrome和firefox(都在OSX上)。 必须有一些明显的东西我不见了……?

在jquery 1.5发行版中破坏了加载function。 您可以在http://bugs.jquery.com/ticket/8125找到错误单。 这在1.5.1版中得到修复。 您可以在http://code.jquery.com/jquery-git.js找到包含所有最新修补程序(包括load())的最新jquery发行版。