Just uncomment echo $flagQueryfrom your PHP code and change it to
echo $flagQuery ? 1 : 0;
because falseit doesn’t output anything.
A AJAX. javascript var onreadystatechange:
function getFlagValue() {
var xmlHttp = new HmlHttpRequest();
xmlHttp.onload = function() {
if (xmlHttp.status==200) yourCustomHandler(xmlHttp.responseText);
};
xmlHttp.open("GET","getAmazonResult.php",true);
xmlHttp.send();
}
function yourCustomHandler(response) {
flagQuery = response;
alert(flagQuery);
}
, , false :
xmlHttp.open("GET","getAmazonResult.php",false)
return Text getValue(), , , javascript .
: ActiveXObject , . . XHR2: JS- XHR2 ), , .
, PHP , - flagQuery:
if ($totalResults > MAX_RESULT_ALL_PAGES) {
$queryUrl = ...
$flagQuery = FALSE;
} else {
$queryUrl = ...
$flagQuery = TRUE;
}
echo $flagQuery ? 1 : 0;