Skip to content

Instantly share code, notes, and snippets.

@lsmith
Created March 23, 2009 20:57
Show Gist options
  • Save lsmith/83773 to your computer and use it in GitHub Desktop.
Save lsmith/83773 to your computer and use it in GitHub Desktop.
new YAHOO.util.XHRDataSource(url, {
responseType: YAHOO.util.DataSource.TYPE_JSON,
responseSchema: {
resultsList: 'Results',
fields: [ 'foo', 'bar', 'baz' ]
}
}).sendRequest(queryString, {
// handler that will execute when the XHR returns
success: function (req, res, payload) {
/* here's where you access the results from res.results */
},
// handler that will execute if the XHR fails
failure: function (req, res, payload) {
},
// object that is returned into the success/failure handler
argument: /* if you need transaction specific stuff sent to your callbacks */ null
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment