The following code sends some data to a PHP file. That PHP file encodes to a JSON object and echoes three variables error
, success
, and action
.
However, neither the success function here, nor the error function appear to be returning that JSON object.
How would one get the values for these three keys back.
$.ajax({
type: 'POST',
contentType: "application/json; charset=utf-8",
url: ua['url'],
data: { sconnect: 'email', email : $('#semail').val(), hack:86 },
dataType: 'json',
success: function (data) {
alert(data['success']); alert(data['error']); alert(data['action']);
},
error: function(data){
alert(data['success']); alert(data['error']); alert(data['action']);
}
});