Created
May 14, 2014 17:09
-
-
Save trestles/284ced332673d0538417 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// assign to body tag such that if it's html written to DOM after page has been loaded, if not | |
// $('.buy-btn').on('click', function(){ | |
$('body').on('click', '.buy-btn', function(){ | |
if($("#package-1").is(':checked')){ | |
// get pacakge-sub-values and build data_val | |
data_val={{package_1:true, ....}} | |
}else if($("#package-2").is(':checked')) { | |
// get pacakge-sub-values | |
data_val={{package_2:true, ....}} | |
} | |
$.ajax({ | |
url: "/arc/v1/api/order/", j | |
type: 'POST', | |
data: data_val, | |
dataType: 'json' | |
}).done(function(r) { | |
// r is what your api has returned | |
// wipe out the form via something like: | |
$('#order-form').hide('slow'); | |
$('#order-container').html('thx for order. An email has been sent') | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment