Skip to content

Instantly share code, notes, and snippets.

@MihailoJoksimovic
Created February 18, 2014 15:15
Show Gist options
  • Save MihailoJoksimovic/9072909 to your computer and use it in GitHub Desktop.
Save MihailoJoksimovic/9072909 to your computer and use it in GitHub Desktop.
addArticleToCart = function(articleId, quantity, opts){
var opts = opts || {},
success = opts.success || function(){},
failure = opts.failure || function(){},
callback = opts.callback || function(){},
scope = opts.scope || this;
Ext.Ajax.request({
url: p4t.rootPath + '/modules/eprocurement/Cart/addArticle',
params: {
csrfi: p4t.csrf.id,
article_id: articleId,
quantity: quantity
},
success: function(response) {
var response = Ext.decode(response.responseText);
if (response.success) {
success.call(scope);
} else {
failure.call(scope);
}
},
failure: function() {
failure.call(scope);
},
callback: function(options, success) {
callback.call(scope, success);
}
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment