Skip to content

Instantly share code, notes, and snippets.


shankardevy/ajax_cart.js Secret

Last active Jul 8, 2017
What would you like to do?
function ajaxHandler(e) {
var post_url = $(this).attr("action"); //get form action url
var form_data = $(this).serialize(); //Encode form elements for submission
$.post( post_url, form_data, function( response ) {
$.bootstrapGrowl(response.message, {
offset: {from: 'top', amount: 60},
type: 'success'
var ajaxCart = {
init: function() {
$(".cart-form").on('submit', ajaxHandler)
export default ajaxCart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment