when you run ajax and communicate with php. youre going to grab whatever php echoes out and use that. in this case its probably wisest to use json encode. heres a very basic example to give you an idea.
a php file:
echo json_encode(array('success' => true));
now a basic ajax request
$.ajax({url:"ajax.php",success:function(result){
result = $.parseJSON(result); // we do this to convert the php into javascript format
if(result.success){
alert('this is true');
}
}});