javascript - loading external json object from external file -
i've seen question asked several times, solutions aren't working. @ this link, there's nameless json object. i'm trying access data in object. i've tried far:

$.getjson returning different errors. read adding "&callback=?" url stop "access-control-allow-origin" error, worked, ran "unexpected token :" error. json data looks correct me, though.
i tried doing this:
<!doctype html> <html> <head> <script src="jquery-latest.min.js" type="text/javascript"></script> </head> <body> </body> </html> <script> var jsondata = {} $(document).ready(function() { url = //removed prevent line wrap $.getjson(url + "&callback=?", function(data) { jsondata = data; } ); }); </script> it produced same unexpected token error. ideas?
you need separate url path parameters ?, not &. server doesn't request because can't find resource named accel-partners.js&callback=. does, however, know of resource named accel-partners.js.
try this:
$(document).ready(function() { url = //removed prevent line wrap var callback = ???; // make sure define callback here $.getjson(url + "?callback=" + callback, function(data) { jsondata = data; } ); });
Comments
Post a Comment