Php + ajax | can I receive feedback from more than two ajax?

$.ajax({
      type: "GET",
      url: "url.php",
      success: function(data){
      }

suppose I use this to play
if I print out console.log (data), I can print my echo
in url.php, but if I need to receive more than two responses, what if I need to receive more than two responses? Can you separate me?

for example, I sent back on url.php

echo "ok";

echo "some data";

if it is printed directly, it will become

.
oksome data

but I ajax the first one to confirm whether ok, second, I want to let him count back, not just ok , I also want to check other data
how to achieve this?


return the json array to learn about


json data is returned from the backend!

echo json_encode(['status' => 'ok', 'data' => '...']);
function({status,data}) {
   // status => ok
   // data => ...
}

learn about persistent connections


you can directly return json data
return json_encode (['status'= > somestatus,'message'= > messagevalue]);
however, it is worth noting that in some special cases, the json generated by the backend phpjson_encode cannot be parsed without the front end (because the json from the json_code function is not json data in the strict sense, so the front end cannot be parsed)
then, you can write a global function
$array = ['A'> 1'M'= > 2'M'> 3] of arrayToJson.
foreach ($array as $k = > $v) $list [] = sprintf ('"% s": "% s", $k, $v);
echo'{'. Join (',', $list). '}';
this completes the splicing of a json. For json data that can also be used in strict mode,


returns json to solve the problem.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b31a06-2b5ff.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b31a06-2b5ff.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?