Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $t.customTwitterSearch = $t.createClass(null, {
- init : function(requestOptions) {
- this.__requestOptions = $.extend({}, requestOptions);
- },
- process : function(settings) {
- this.settings = settings;
- if (this.__requestOptions.echo) {
- settings.success(this.__requestOptions.echo);
- } else {
- $.ajax({
- url: "http://search.twitter.com/search.json?q=help",
- context: this,
- dataType: "jsonp"
- }).done(this.onAjaxDone).error(this.onAjaxError);
- showSpinner();
- }
- },
- onAjaxDone: function(data) {
- //You can filter "data" here
- this.settings.success(data);
- this.settings.complete('success');
- hideSpinner();
- },
- onAjaxError: function(jqXHR, textStatus, errorThrown) {
- this.settings.error(jqXHR, textStatus, errorThrown);
- this.settings.complete('error');
- hideSpinner();
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement