Although i used getJSON in http://jsbin.com/dbJSON/edit i have not been able to connect with any of my own made up data. i tried 4, and the example at Flickr for "cats". Only the latter worked... this is the output:
{assoc: null,assoc.js: null,stub: null,stub.js: null,cat: [object Object]}
i am at that "base", as i did get the image there, but
db.tgu.ca/repsychal/poems/10/0512-g2g/assoc.json
db.tgu.ca/repsychal/poems/10/0512-g2g/assoc.js db.tgu.ca/repsychal/poems/10/0512-g2g/stub.json db.tgu.ca/repsychal/poems/10/0512-g2g/stub.jswere all invisible==null! (they are all URL, just pu开发者_如何学Pythont h t t p //: in front ... a restriction on the # of URL in a post)
How do i get "my" data into the page?
Now that jQuery is more strict on their parsing of JSON data, the document header plays a part now, too.
If you enter your path to assoc.json in the url bar, notice how it serves a binary file that the browser doesn't even know what to do with? Too, if you look at the headers they are text/html; charset=UTF-8, when they should be application/x-javascript; charset=utf-8 (as flickr's is)
One you are serving your file properly, jQuery can read and parse it.
You should be able to enter your path to your json in the URL bar of your browser and see it's output, just as you can with the path to flickr's api.
精彩评论