1

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/isimpledesign/NTdBp/

im getting this error

1Uncaught SyntaxError: Unexpected token :
2
  • 1
    JSONlint gives me "Valid JSON" for this URL. You generally cannot retrieve any 3rd party resources from JavaScript due to the same-origin policy, that's why it does not work on jsFiddle (for this reason they have their own HTTP responder) Commented Aug 12, 2011 at 13:56
  • soz i have updated the question Commented Aug 12, 2011 at 13:56

1 Answer 1

1

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>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.