我正在尝试使用Markit on demand Api进行简单的股票搜索,但是当我尝试通过API访问数据时,我在JSON上得到“Uncaught SyntaxError:Unexpected token:”。错误中返回的JSON是正确的:
{"Data":{"Status":"SUCCESS","Name":"Apple Inc","Symbol":"AAPL","LastPrice":482.73,"Change":-0.0199999999999818,"ChangePercent":-0.00414293112376285,"Timestamp":"Fri Sep 27 15:59:59 UTC-04:00 2013","MarketCap":438558756810,"Volume":642152,"ChangeYTD":532.1729,"ChangePercentYTD":-9.29075869891158,"High":484.635,"Low":480.72,"Open":483.64}}
如何修复此错误?
请参阅我的JSfiddle http://jsfiddle.net/tgilbert/fXgLt/获取代码。
非常感谢任何帮助。
答案 0 :(得分:1)
您已将dataType设置为'jsonp',因此jQuery正在尝试执行jsonp请求并期望响应是有效的javascript,而不仅仅是json。