I want to use $.ajax
w/ JSON data (window.jsonData = '{"dataCallback":[{"key":"val"}]})';
) stored in global variable inside the same local js document. Is this possible and if so how would I do it?
Update: It seems like $.ajax()
, $.getJSON()
, $.get()
, $.getScript()
all require url (which can point to a local or remote file) as the data source.
How can I use the global window.jsonData
as the source of data?
See: http://jsfiddle.net/Dns2r/. Feel free to play around.