Im getting an error 200 in my ajax request. Im wanting to post 1 value which is a email address to the page in my ajax request. Could someone tell me what is wrong
Error:
message=:[object Object], text status=:parsererror, error thrown:=SyntaxError: JSON.parse: unexpected end of data
JQuery
$('#checkemail').click(function() {
$.ajax({
url:'http://' + location.host + '/buyme/include/getemailaddress.php',
type:'POST',
contentType: "application/json; charset=utf-8",
data: {email:$('#email').val()},
dataType:"json",
success: function(msg) {
alert(msg);
},
error: function(ms, textStatus, errorThrown) {
alert(errorThrown);
}
});/**/
});
As you are using json data type any returned data from server must be in that format.
So FIRST Don’t forget that you send
postdata, so work with:So in your jquery callback you get returned data like this: