大家好我正在尝试设置json feed。
我一直在使用以下网址
http://rest.users34.interdns.co.uk/index.php?format=json
然后输出json。
但我无法通过jquery json抓住Feed,如下所示
http://jsfiddle.net/isimpledesign/NTdBp/
我收到此错误
1Uncaught SyntaxError: Unexpected token :
答案 0 :(得分:1)
JSONP需要包含在( )
中。所以
{"jim":{"address":"356 Trailer Park Avenue","url":"\/clients\/jim"},"anne":{"address":"6321 Tycoon Road","url":"\/clients\/anne"}}
需要
({"jim":{"address":"356 Trailer Park Avenue","url":"\/clients\/jim"},"anne":{"address":"6321 Tycoon Road","url":"\/clients\/anne"}})
如果您将每个粘贴到javascript控制台中,您实际上可以验证这一点。第一个是语法错误,第二个是您要查找的对象。您将需要以下标记才能抛出错误:
<script src="http://rest.users34.interdns.co.uk/index.php?format=json"></script>