I've got a AJAX function running which returns a response and I need to get the values from the responseText
jQuery.ajax({
url: process_payment.ajaxurl,
type: 'post',
dataType: 'json',
data: {
action: 'process_payment',
payment_method_id: result.paymentMethod.id
},
complete: function(json) {
var response = json.responseText;
console.log(response);
handleServerResponse(json);
}
})
This is the contents of the variable response
{"requires_action":true,"payment_intent_client_secret":"0eo9ei48494404014044"}0
How do i the value of 'requires_action
' for example, i thought i could do response.requires_action
but this returns undefined.
EDIT
This is also not working:
jQuery.post(process_payment.ajaxurl, {
action: 'process_payment',
payment_method_id: result.paymentMethod.id
}, 'json').done(handleServerResponse)
function handleServerResponse(response) {
console.log(response);
}