使用jquery ajax请求的语法错误

时间:2013-11-30 04:05:43

标签: javascript jquery ajax

我做错了什么,有些想法? 控制台>未捕获的SyntaxError:意外的令牌;

$.ajax ({  
    url:     'php/loaders/news_loader.php',
    type:    'post',
    data:    post_data,
    success: function(request, settings)
             { 
                 if(request.trim() != '')
                 {
                     // something is wrong in the next line... 
                     $('#news').html( request + $('#news').html() ); 
                 } 
             }  
});

1 个答案:

答案 0 :(得分:0)

试试这个:

$.ajax ({  
    url:     'php/loaders/news_loader.php',
    type:    'post',
    data:    post_data,
    dataType:'json',
    success: function(request, settings)
             { 
                 if(request.trim() != '')
                 {
                     // something is wrong in the next line... 
                     $('#news').html( request + $('#news').html() ); 
                 } 
             }  
});