我是一個完整的jquery新手,但我跟着this tutorial here讓我開始。
我是有工作了,但(我甚至不知道我做了什麼),現在一切都只是去了下來...
這裏的片段(見註釋):
$(function() {
//This one here works and gets executed after the page has loaded
$.getScript("some link copied from one of the actual hrefs");
//Handler for some links that should load some js from the server and execute it
$('#searchresults .pagination a').live('click',
function(event) {
//This shows the correct link:
alert(this.href);
//However, this one doesn't even send a request:
$.getScript(this.href);
return false;
});
});
我正在使用JQuery 1.5.2。另外值得注意的是:爲了調試的目的,我安裝了FireQuery,並且每次加載該網站時它都會不斷轟擊我「jQuery(...) called incorrectly
」。當我點擊其中一個鏈接時,它會給我「When I called jQuery.get(...) with your args, an error was thrown! TypeError: rootjQuery is undefined
」。
看到我以爲我的jquery.js文件可能已損壞,所以我剛剛下載並安裝它。沒有運氣,但...
讚賞任何幫助,THX
嘗試將url硬編碼到$ .getScript中(在此粘貼警報url);並查看該URL是否是有效的路徑。 – nolabel 2011-04-07 21:14:44