weixin_33733810 2014-11-18 12:52 采纳率: 0%
浏览 21

意外令牌D

I understand this question has been asked many times but I am still not able to get the error. I am trying to parse text coming from server.

"MARUTI"
"MAHINDRA AND MAHINDRA"
"FIAT"

Every texts parsed except "MAHINDRA AND MAHINDRA". I do not understand where the problem is. here is my code.

var myObject = JSON.parse(httpxml.responseText);

Error in Console

Uncaught SyntaxError: Unexpected token D 

Please help.

  • 写回答

1条回答 默认 最新

  • weixin_33693070 2014-11-18 12:54
    关注

    Thats not a JSON String. You should inform about JSON

    http://en.wikipedia.org/wiki/JSON

    Return a JSON string from your server. With PHP you can use json_encode to encode an array to a json string.

    评论

报告相同问题?