You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@shindig.apache.org by Gustavo Monarin <gu...@gmail.com> on 2013/12/06 10:20:11 UTC
makeRequest vs xhr
Hi,
I have experienced some problems using the gadgets.io.makeRequest, which
make me think about using directly jquery for all my ajax requests... is it
a problem? are differences between the both options?
Regards
--
Gustavo
Re: makeRequest vs xhr
Posted by Stanton Sievers <ss...@apache.org>.
In addition to what Ryan said, if you do really want to use XHR and not
makeRequest, you'll need to use JSONP to make cross-domain requests and not
a traditional XHR request. Most libraries, such as jQuery, provide a JSONP
mechanism.
In my opinion it's easier to use makeRequest in a gadget instead of messing
with XHR or JSONP.
-Stanton
On Fri, Dec 6, 2013 at 8:57 AM, Ryan Baxter <rb...@apache.org> wrote:
> Hi Gustavo,
>
> The reason why OpenSocial provides gadgets with the makeRequest API is
> because in theory the gadget can be placed within any container. The
> domain the gadget renders on could be different every time it renders,
> even within the same container. The makeRequest API allows the gadget
> developer to avoid the same domain restrictions of the browser. Using
> other XHR APIs like JQuery's is fine as long as you gadget will always
> be rendered on the same domain as the domain you are making your XHR
> requests too. And you are fine sacrificing other features like OAuth.
>
> On Fri, Dec 6, 2013 at 4:20 AM, Gustavo Monarin
> <gu...@gmail.com> wrote:
> > Hi,
> >
> > I have experienced some problems using the gadgets.io.makeRequest, which
> > make me think about using directly jquery for all my ajax requests... is
> it
> > a problem? are differences between the both options?
> >
> > Regards
> >
> > --
> >
> > Gustavo
>
Re: makeRequest vs xhr
Posted by Ryan Baxter <rb...@apache.org>.
Hi Gustavo,
The reason why OpenSocial provides gadgets with the makeRequest API is
because in theory the gadget can be placed within any container. The
domain the gadget renders on could be different every time it renders,
even within the same container. The makeRequest API allows the gadget
developer to avoid the same domain restrictions of the browser. Using
other XHR APIs like JQuery's is fine as long as you gadget will always
be rendered on the same domain as the domain you are making your XHR
requests too. And you are fine sacrificing other features like OAuth.
On Fri, Dec 6, 2013 at 4:20 AM, Gustavo Monarin
<gu...@gmail.com> wrote:
> Hi,
>
> I have experienced some problems using the gadgets.io.makeRequest, which
> make me think about using directly jquery for all my ajax requests... is it
> a problem? are differences between the both options?
>
> Regards
>
> --
>
> Gustavo