Recently I came across the issue of Cross-Domain ajax requests. Since I am a mootools lover I started looking over for some adapter that can help me do that. I came across many solutions which apperantly seemed to work. The flXHR, Fjax they all seemed to be there but I was already using mootools in my project right? Why should I write the boiler plate onreadystatus change when its already done! Ok then I there must be adapter for these. And guess what flXHR provided adapters of Prototype, jQuery, Dojo, but not mootools. So I took up the headache reading up the checked out Git of mootools Request.js and fortunately it provided me with a well crafted interface exactly same as XMLHTTPRequest ( except few things which were obviously to be cross-domain specific). So I have implemented a XDomain (Cross domain adapter for flXHR). You can enjoy the treat demo here.

Download mooflXHR file here. Dependecies:

Mootools

flXHR

The adapter provides with a mooflXHR object and a mooflXHR.JSON object. Both of them are excatly following the same API as that of Request and Request.JSON respectively. In options you can specify an additional option of XDomain. This XDomain object will be passed to the constructor of flXHR providing you the ability to customize the power of flXHR without breaking the Request style abstraction. A simple example can be:

var mooflProxy = new mooflXHR.JSON({ XDomain: { noCacheHeader:false, loadPolicyURL:"http://search.yahooapis.com/crossdomain.xml" }, url: "http://search.yahooapis.com/ImageSearchService/V1/imageSearch", method: "GET", onSuccess: doFoo, onFailure: dontFoo });

Hope you enjoy the XDomain.