Home › Forums › Back End › Editable form fields? › Reply To: Editable form fields?
May 21, 2014 at 1:15 pm
#170824
Participant
TheDoc’s example was basically it.
(it looks like this after you convert it to javascript)
var request;
request = $.ajax({
type: "POST",
url: "payment.php",
dataType: "json",
async: true,
data: {
stripeToken: token.id,
email: token.email,
name: args.billing_name,
address: args.shipping_address_line1,
city: args.shipping_address_city,
state: args.shipping_address_state,
zip: args.shipping_address_zip,
country: args.shipping_address_country
}
});
request.done(function(customer) {
return console.log(customer);
});
request.fail(function(jqXHR, textStatus) {
console.log(jqXHR);
return console.log(textStatus);
});
Once you understand how to send the POST, and that PHP’s response needs to be in a particular format (e.g., json), it’s no more complicated than any other form submission+processing.