Skip to content

Instantly share code, notes, and snippets.

@cohitre
Created April 30, 2009 02:46
Show Gist options
  • Save cohitre/104216 to your computer and use it in GitHub Desktop.
Save cohitre/104216 to your computer and use it in GitHub Desktop.
jQuery.fn.quickCheckout = function( url ) {
var form = $("<form />")
.attr({ action:url, method:"POST"})
.append("<input type='submit' />")
.appendTo(this);
this.data( "quickCheckoutForm" , form );
return this;
}
jQuery.fn.quickCheckoutAdd = function( name , value) {
if ( !this.data("quickCheckoutForm") ) { return this; }
this.data("quickCheckoutForm")
.append( $("<input type='hidden'/>").val(value).attr("name",name) );
return this;
}
$("#shopping-cart")
.quickCheckout("http://cohitre.com/handle/shoppingCart");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment