2013-03-29 83 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 
}); 
相关问题