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 <[email protected]> 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
> <[email protected]> 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
>

Reply via email to