当字符串返回到 JSONP Jquery 调用时出现无效 JSON 错误
我有下面的 JSONP 完整字符串,它从我的 aspx 页面返回到客户端。
"processjsonp({\"result\": [\"CreateCityKeys\", \"Keyword -Spokane already exists in City\r\nKeyword -Anchorage already exists in City\r\nKeyword -Fairbanks already exists in City\r\nKeyword -Bellingham already exists in City\r\nKeyword -Juneau already exists in City\r\nKeyword -Boise already exists in City\r\nKeyword -Victoria already exists in City\r\nKeyword -Kelowna already exists in City\r\nKeyword -Eugene already exists in City\r\nKeyword -Medford already exists in City\r\nKeyword -Tucson already exists in City\r\nKeyword -Walla Walla already exists in City\r\nKeyword -Wenatchee already exists in City\r\nKeyword -Pasco already exists in City\r\nKeyword -Pullman already exists in City\r\nKeyword -Redmond already exists in City\r\nKeyword -Yakima already exists in City\r\nKeyword -Ketchikan already exists in City\r\nKeyword -Kauai Island already exists in City\r\nKeyword -Kona already exists in City\r\nKeyword -Kahului already exists in City\r\n\"]})"
我知道错误一定是由于之间的 \r\n 造成的,请建议消除它。
谢谢
女士。
编辑:错误 - JSONP 解析器错误
I am having below JSONP full string which is return back to clientside from my aspx page.
"processjsonp({\"result\": [\"CreateCityKeys\", \"Keyword -Spokane already exists in City\r\nKeyword -Anchorage already exists in City\r\nKeyword -Fairbanks already exists in City\r\nKeyword -Bellingham already exists in City\r\nKeyword -Juneau already exists in City\r\nKeyword -Boise already exists in City\r\nKeyword -Victoria already exists in City\r\nKeyword -Kelowna already exists in City\r\nKeyword -Eugene already exists in City\r\nKeyword -Medford already exists in City\r\nKeyword -Tucson already exists in City\r\nKeyword -Walla Walla already exists in City\r\nKeyword -Wenatchee already exists in City\r\nKeyword -Pasco already exists in City\r\nKeyword -Pullman already exists in City\r\nKeyword -Redmond already exists in City\r\nKeyword -Yakima already exists in City\r\nKeyword -Ketchikan already exists in City\r\nKeyword -Kauai Island already exists in City\r\nKeyword -Kona already exists in City\r\nKeyword -Kahului already exists in City\r\n\"]})"
I know the error must be beacuse of \r\n in between, please suggest to get rid of this.
Thanks
M.S.
EDIT: Error - JSONP parser error
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您的 JSON 语法不正确,您可以将 \" 替换为 " 并检查解析器字符串限制 这里讨论关于这个
Your JSON syntax is not correct, You may replace \" with just " and chech the parser string limitation here talks about this
服务器响应示例:
jquery 演示:
example server response:
demo with jquery: