I'm a .NET guy and don't know the syntax for PHP, but maybe I could put it in plain terms
- variable "CallBackName" = value of "callback" (which jQuery will replace "?" with "jsonpNNNNNNN" where NNNNNN is a timestamp just to be random - variable MyResults is an object that is expressed in a JSON string (i know that it's easy to write/convert-to JSON in php but I don't know the specifics) - If there is a CallBackName value, then write out CallBackName( my JSON result ) otherwise, just write out my JSON result So in html if i had $.getJSON("local_call.php", ......) i'd return from the server { foo: "1", bar: "2"} but if i had $.getJSON("http://remoteserver/local_call.php?callback=?", ......) jQuery would replace "?" with something like "jsonp2345654345", so my code would return jsonp2345654345( { foo: "1", bar: "2"} ) the example on the jQuery docs under .getJSON (using Flickr) is a great thing to read.... and the article @ IBM that is inside my previous link is an excellent overview as well..... once you understand how it works, that makes it easy :-) On Oct 23, 10:27 am, jayQuery <xaudio...@yahoo.co.uk> wrote: > I see what you mean... > > I thought it was that simple... > So I should generate my json via a server-language (like php) and echo > that callback as in the post you refered? > I'll try that and keep you posted. > > On Oct 23, 3:22 pm, MorningZ <morni...@gmail.com> wrote: > > > "the strange thing is that if I don't use jsonp (by using the callback > > query), it works locally. But obviously won't work when in a cross > > domain environment. " > > > It's not as easy as putting "callback=?" in the url.. you have to wrap > > the JSON you are generating in a function name so that jQuery can > > process it when it gets the response... > > > cross domain jsonp absolutely for sure works, but you are not > > implementing it correctly... maybe show more code and what Firebug > > shows the response to be? > > > On Oct 23, 9:50 am, jayQuery <xaudio...@yahoo.co.uk> wrote: > > > > didn't help... > > > > the strange thing is that if I don't use jsonp (by using the callback > > > query), it works locally. But obviously won't work when in a cross > > > domain environment. > > > > On Oct 23, 2:37 pm, MorningZ <morni...@gmail.com> wrote: > > > > > See if this reply i made yesterday helps you out at all > > > > >http://groups.google.com/group/jquery-en/browse_thread/thread/1525b2d...