Why is a strange value transmitted from php to JS? I want to transfer 0 from a. php to B. js, but there is a huge string! The original code is as follows: a. php file: & lt ;? Phpecho & quot; 0 & quot ;;? & Gt; B. js file: functionget_C () {& nbsp; if (xmlHttp. readyState4 | xmlHttp. readyState is passed to JS from php, but a strange value is returned?
I want to transfer 0 from a. php to B. js, but there is a huge string! The original code is as follows:
A. php file:
Echo "0 ";
?>
B. js file:
Function get_C ()
{
If (xmlHttp. readyState = 4 | xmlHttp. readyState = "complete ")
{
Var c = xmlHttp. responseText;
Alert (c );
}
}
The result of the dialog box is as follows:
Untitled Document
0
What's going on? Can I remove a lot of the above?
------ Solution --------------------
A outputs json
B. read json alert
------ Solution --------------------
Where did the preceding html come from? Run a. php and check the source code. Check whether there is any html code.