The page appears as follows:
The code in jqueryajax.html is as follows (a simpler $.post)
ajax.php
<?php
echo ' username: ', $_post[' name ', ', Password: ', $_post[' pwd '. <br> ";
Here are some things to do, such as database interaction
echo "Operation complete";
? >
In non-JSON format, the background can only return strings, and if you want to return the array in the background, you can use the JSON format
For example, change the code in Jqueryajax to the following form:
ajax.php
<?php
$name = $_post[' name '];
$pwd = $_post[' pwd '];
$array = Array ("$name", "$pwd");
Here's a few things, like database interaction
echo Json_encode ($array);//json_encode Way is necessary
?>
The operation effect is as follows:
The above is the entire content of this article, I hope to help you learn, but also hope that we support the cloud habitat community.