开发者

Json not working through url

Hi all i am trying to setup a json feed.

i have been working from the following url

http://rest.users34.interdns.co.uk/index.php?format=json

this then outputs the json.

http://jsonlint.com/

but i cant grab the feed via jquery json like below

http://jsfiddle.net/isimpledes开发者_开发技巧ign/NTdBp/

im getting this error

1Uncaught SyntaxError: Unexpected token :


JSONP needs to be wrapped in ( ). So

{"jim":{"address":"356 Trailer Park Avenue","url":"\/clients\/jim"},"anne":{"address":"6321 Tycoon Road","url":"\/clients\/anne"}}

needs to be

({"jim":{"address":"356 Trailer Park Avenue","url":"\/clients\/jim"},"anne":{"address":"6321 Tycoon Road","url":"\/clients\/anne"}})

You can actually verify this, if you pasted each into a javascript console. The first is a syntax error, and the second is the object you are looking for. You will need the following tag to not throw an error:

<script src="http://rest.users34.interdns.co.uk/index.php?format=json"></script>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜