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.
精彩评论