On May 12, 11:59 am, Roy M <setesting...@gmail.com> wrote:
> Hello,
>
> Currently I was able to load remote JSON (php) file using JSONP
> protocol.
>
> However, how to do if my remote file is static?
>
> In the doc, it said:
>
> you can load JSON data located on another domain if you specify a
> JSONP callback, which can be done like so: "myurl?callback=?".
>
> But since my remote file is a static text file, how can I specify the
> callback in the output dynamically?

If it's static, you can't do anything dynamically... hard-coding a
callback function should work:
( in yourfile.js)
myCallback({ json })

>
> In fact, I also wonder if it is possible to control the random
> callback name by modifying jquery source code...

In your case you can just declare the function as you know it's name
and use getScript:

function myCallback( data ){
  //do stuff
}
$.getScript('myjsonpfile.js');

Reply via email to