A JSON returned as response to this request is not recognized.
request = $.ajax({
url: "form_handler.php",
type: "post",
dataType: "json",
data: serializedData
});
The php code in form_handler.php
which returns the response:
if ($success) {
echo json_encode(array("success"=>"false"), JSON_PRETTY_PRINT);
}
else
{
echo json_encode(array("success"=>"true"), JSON_PRETTY_PRINT);
}
And thus in:
request.done(data)
{
alert(data.success); // error: cannot read property of 'success' of null
}