我得到以下输出的字符串从json_encode
:json_encode的输出()含有斜线的字符串不能被JSON.parse(解析)
["images\/zara\/shoes\/thumbnail",
"images\/hermes\/shoes\/thumbnail",
"images\/hermes\/shoes\/thumbnail"]
我试图与下面解析它代码,但它给我一个错误:
var listofshoes = JSON.parse(data);
for (var i in listofshoes) {
$('#pgwrapid').append($("<p>").text(listofshoes[i]));
}
ERROR: JSON.parse: unexpected character [Break On This Error] return window.JSON.parse(data);`
如何避免这种情况?
代码不起作用 – sajid 2012-01-09 06:40:47
@sajid:有错误? – 2012-01-09 07:18:40