-9

Really confused, I can't find anything wrong!

enter image description here

4

2 回答 2

5

You can't declare a variable within an object literal. Move pid outside:

var pid = ...

$.ajax({ ... });
于 2013-03-29T19:32:03.090 回答
1

You cannot have a var statement inside of an object literal. You can only have object properties inside of an object literal, with the key: value format.

I think you are wanting something like this.

var pid = $("span#live-news:first").attr("id");
$.ajax({
  // all the AJAX options go here
});
于 2013-03-29T19:31:25.570 回答