getjson and servers

Posted by gheil.apl on Stack Overflow See other posts from Stack Overflow or by gheil.apl
Published on 2010-05-23T22:25:31Z Indexed on 2010/05/23 22:31 UTC
Read the original article Hit count: 303

Filed under:
|
|

Is getJSON only useful for those who control a server? Is there any other alternative for getting data from a file?

i tried

 $.getJSON("good.json", function(data){  
    out=out+"good.json: "+data + ",";  });  

where good.json = {"a":"1","b":"2"} and got a result of 'null' for data.

These all are valid JSON files, and all give null when used in the above:
good.htm assoc.json assoc.js stub.json stub.js test.js test.txt
and all get a null result...

The above is in an interactive setting at http://jsbin.com/dbJSON/8/edit

the output (of null) is to be had by clicking 'output'.

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about server