parsing json error : SyntaxError: JSON.parse: unexpected character at line 1 column 2 of the JSON data

后端 未结 1 777
没有蜡笔的小新
没有蜡笔的小新 2020-12-11 13:17

i have a problem when parsing json from php to javascript

this is my example code :

//function
MethodAjax = function (wsFile, param) {
    return $.a         


        
相关标签:
1条回答
  • 2020-12-11 13:45

    jQuery's $.ajax() function will yield a JavaScript object if the response is JSON so I believe the error you're seeing is a result of trying to parse a JavaScript object and not a string as you're expecting. In the callback you're providing to the done function, inspect data and you'll find that it's an object and there is no need to JSON.parse the result.

    0 讨论(0)
提交回复
热议问题