Current location - Health Preservation Learning Network - Slimming men and women - How does jquery receive php return values?
How does jquery receive php return values?
For multiple outputs, it is not possible to specify one output.

You need to put what you want to output into an array, and then json_encode, loop through js to find the value you want.

For example:

//What do you need to output?

echo‘AAA’; echo‘BBB’; echo“”CCC;

//synthetic array

$ data = array(' name 1 ' = & gt; aaa ',' name2 ' = & gtbbb ',' name2 ' = & gtCCC’);

//json_encode

$ data = JSON _ encode($ data);

//output

echo $ data

js:

$.post('aa.php ','',function(mes){

var data = eval(('+msg+')');

var name 1 = data[' name 1 '];

var name 2 = data[' name 2 '];

var name 3 = data[' name 3 '];

})

I hope it helps you.