The same source code can be run locally and cannot be executed on the server. I wrote an ajax request. I tested it locally, but I couldn't execute it on the server. Why? You have never had this situation. AjaxJScriptcodefunctionshowList (id) {the same source code can be run locally and cannot be executed on the server.
I wrote an ajax request. I tested it locally, but I couldn't execute it on the server. Why?
You have never had this situation.
Ajax
JScript code
Function showList (id) {url = 'ajaxlist. php '; $. get (url, {id: id}, function (e) {if (e = 0) {$ ("# info" ).html ("No payment information ");} else {$ ("# info" ).html (e );}});}
PHP code
Db_Query($sql);$row=$news->Db_Fetch_Array();if($row){ echo json_decode($row['paytype']);}else{ die(0);}?>
Server:
------ Solution --------------------
First, check whether the server supports json. should json_encode be used?
------ Solution --------------------
Is the database matched? what is the table name of the user name and password?
------ Solution --------------------
Url = 'ajaxlist. php'; the path is incorrect. Try it with absolute
------ Solution --------------------
Use var_dump to output background data and firebug to check whether the data format passed in the background is correct. Is it a traditional ajax problem such as bom header and encoding?
------ Solution --------------------
Discussion
Use var_dump to output background data and firebug to check whether the data format passed in the background is correct. Is it a traditional ajax problem such as bom header and encoding?
------ Solution --------------------
$. Get (url, {id: id },
Function (e ){
If (e = 0 ){
$ ("# Info" ).html ("No payment information ");
} Else {
$ ("# Info" ).html (e );
}
}); Is your get method type supposed to be json transfer.
------ Solution --------------------
$. Get (url, {id: id },???
$. Get (url, {'id': id },
I wonder if I have a mistake
Run the server program separately to check whether the returned results are normal.