...
In either case, it should be noted that dojo's xhr module will not work well in a gadget environment and some tweaking is required to get it to work transparently. An example of piping dojo's xhr requests through the osapi.http api is shown below.