jquery使用ajax报错[Uncaught SyntaxError: Unexpected token :]

时间:2023-03-09 00:53:39
jquery使用ajax报错[Uncaught SyntaxError: Unexpected token :]
 $.post('/ajax/validate.do',{"id": id},function(ret){
//ret
});

返回值明明是json,格式也是正确的,却解析不成功,在Google Chrome下报错——Uncaught SyntaxError: Unexpected token :

http://*.com/questions/3143698/uncaught-syntaxerror-unexpected-token

解决方法:

$(function(){
$.post("/ajax/json.do",{'id':id},function(ret){
//ret;
}, "json");
});