开发者

Uncaught SyntaxError: Unexpected token

I have code like this:

$(function(){
  $('.plus').click(function(){ 
  var url = "/accounts/profile/update_thing/" + $(this).parent().attr('id') + "/",
  $.getJSON(url, function(data){
var items = []

  $.each(data, function(key, val) {
    items.push('<li 开发者_开发问答id="' + key + '">' + val + '</li>');
  });

  $('<ul/>', {
    'class': 'my-new-list',
    html: items.join('')
  }).appendTo('body');
});  })  
})

And Chrome code spectrator saying that i have Uncaught SyntaxError: Unexpected token . in line 4. But I don't know why. Does someone knows what is about?

Ps. Is it normal that I haven't text editor on this site?


var url = "/accounts/profile/update_thing/" + $(this).parent().attr('id') + "/",
  $.getJSON(url, function(data){

...is clearly wrong. Did you mean ; on the first line?

If you indent your code properly then mistakes will be easier to spot.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜