parsing json error : SyntaxError: JSON.parse: unexpected character at line 1 column 2 of the JSON data
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: i have a problem when parsing json from php to javascript this is my example code : //function MethodAjax = function (wsFile, param) { return $.ajax({ type: "POST", dataType: "json", url: '../proses/' + wsFile + ".proses.php", data: 'param='+param, error: function (msg) { return; }, }); }; //call function $(document).ready(function() { $('#getproduk').click(function(){ var param = { ProdukId : '1', ProdukName : 'test' }; CallMethodWithAjax('try', JSON.stringify(param)).done(function(data){ $data = JSON && JSON.parse(data) || $.parseJSON(data