Ive created a backbone.js view that will submit user login details to a codeigniter controller and after verifying it will send a response of boolean value true or false as the authentication status back to ajax.
$data = array(
'status' => true
);
// Send the response back to the client
print json_encode($data);
When I try to retrieve the response "status" value inside the ondone function of ajax, I get the status value as undefined.
.done(function(data) {
alert("data: " + data)
alert("status: " + data.status)
if (data.status) {
alert("authenticated")
} else {
alert("unauthenticated")
}
window.location = '/CW2/ASSWDCW2/cw2app/index.php/Home/';
});
How can I get the status value inside the on done function of ajax?