I have an ajax script that calls a php file.
The php file echos \"yes\" or \"no\", I want to use the strings to do logical comparisons.
In the javascript,
I think you may be going at it the wrong way. Instead of manually trying to create a response why don´t you use PHP arrays as a data structure and JSON for delivery?
$flag)
$json = json_encode($arr);
// See http://www.geekality.net/2010/06/27/php-how-to-easily-provide-json-and-jsonp/
// Set JSONP header
header('content-type: application/json; charset=utf-8');
// Get callback from $_GET and prepend the JSON data
echo isset($_GET['callback'])
? "{$_GET['callback']}($json)"
: $json;