2013-03-29 82 views

回答

5

您不能在對象文字中聲明變量。 Move pid outside:

var pid = ... 

$.ajax({ ... }); 
1

你不能有一個var聲明對象文本的內部。您只能在對象文字中使用key: value格式的對象屬性。

我想你是想要這樣的事情。

var pid = $("span#live-news:first").attr("id"); 
$.ajax({ 
    // all the AJAX options go here 
}); 
相關問題