Originally Posted by xelawho
that would be ideal.
But if I can't wrap it in a function call (or more accurately, if I didn't want to have to do that manually)?
Could I wrap it programatically? Or is there some other option?
you have to give it a name, or fetch the whole thing with ajax.
programmatic callbacks are simple, for example on windows:
where output.js is your web-read file and data.json is the one you showed already:
echo callback( > output.js
type data.json >>output.js
echo ) >> output.js
i should mention that you can do the same with whatever you use to generate the json in the first place. it writes the files, so just write the callback aorund it at the same time. You can load the file and str.slice(9,-1) to turn the JSONp back into JSON...
i should also mention that you can use ajax offline, i don't see how jsonp is any better than ajax. in fact, it's worse since you don't have a failure event like you do with ajax... Still, both technologies function just fine offline as long as they appear in a correctly-crafted manifest file.
BROWSER STATS [% share]
(2013/10/31) IE7:0.5, IE8:8.6, IE9:5.3, IE10:12.3, FF:17.7, CH:41.8, SF:8.1, MOBILE:20.4