JSFiddle - React, Tailwind, and code Playground
JavaScript
Request.exchange = new Class({
Extends: Request.JSONP,
options: {
url: 'http://rate-exchange.appspot.com/currency?from={from}&to={to}&q={amount}',
amount: 1
},
initialize: function(options){
this.setOptions(options);
this.options.url = this.options.url.substitute(this.options);
this.parent();
}
});
new Request.exchange({
from: 'GBP',
to: 'JPY',
amount: '100',
onSuccess: function(response) {
console.log(response, response.rate, response.v);
}
}).send();