-1

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.js

were all invisible==null! (they are all URL, just put h t t p //: in front ... a restriction on the # of URL in a post)

How do i get "my" data into the page?

4

1 回答 1

0

现在 jQuery 对 JSON 数据的解析更加严格,文档头现在也发挥了作用。

如果您在 url 栏中输入 assoc.json 的路径,请注意它如何提供浏览器甚至不知道如何处理的二进制文件?同样,如果您查看标题,它们是 text/html;charset=UTF-8,当它们应该是application/x-javascript 时;charset=utf-8(就像 flickr 一样)

如果您正确地提供文件,jQuery 可以读取和解析它。

您应该能够在浏览器的 URL 栏中输入您的 json 路径并查看它的输出,就像您可以使用 flickr 的 api 的路径一样。

于 2010-05-22T19:33:44.787 回答