Do you have control over the XML resource? I assume it's coming from some
back-end script that is generating it. If not, you could ask the engineers
that do you have access to allow passing a "callback" GET parameter.



On Mon, Nov 8, 2010 at 9:59 AM, Nacho G <[email protected]> wrote:

> Excuse my ignorance but I'm not sure how to do that and I can't find
> more information about the jsonp callback
> Could you give a little example ?
>
>
> thanks a lot
>
>
>
>
> On Nov 8, 6:31 pm, Sean McArthur <[email protected]> wrote:
> > You could look up the new cross domain request stuff, but using JSONP
> might
> > be easier. It's not parsing the XML as JSON.
> >
> > The idea of JSONP is that you make a cross domain request, and provide a
> > callback function. The server spits out JSON, and wraps it in the
> callback
> > function.
> >
> > my_callback({ "a":"stuff", "b":"otherstuff"});
> >
> > Request.JSONP makes the callback stuff real easy for you. As well, this
> > request is put inside a script element, so it can execute as JavaScript.
> To
> > get your XML request to work, it would have to wrap the XML with the
> > callback method that Request.JSONP is sending, and escape all the XML to
> fit
> > inside a single string.
> >
> > my_callback('<things><thing id="one">a thing</thing><thing id="two">it\'s
> > another thing</thing></things>');
> >
> > On Mon, Nov 8, 2010 at 8:43 AM, Nacho G <[email protected]> wrote:
> > > Hello, I'm trying to get data from a remote XML file but I'm getting a
> > > preflight request with REQUEST because I'm requesting a cross-domain
> > > XMLHttpRequest.
> >
> > > With Request.JSONP I don't have that problem and I get the data from
> > > the remote XML but the problem is that mootools parse the result and
> > > it gives an error as the result is XML not JSON.
> >
> > > how can I make a regular Request avoiding the preflight request? or
> > > how can I stop JSONP from parsing the result?
> >
> > > thanks
>

Reply via email to