This time I will bring you the order of data returned by ajax request operation. What are the precautions for the order of data returned by ajax request operation? The following is a practical case, let's take a look.
ajax requests a url, and after PHP backend processing, thearray is in the following format:
$a = array( '-1'=> 10 ,'-3' => 2, '0' => '5' ,'-2' => 4);
$a = array('-3' => 2, '-2' => 4,'0' => '5', '-1'=> 10 );
$i = 0; foreach ($data as $k => $v) { $tmp[$i]['data'] = $v; $tmp[$i]['key'] = $k; $i++; }
{ "rows": [ { "data": "2", "key": 0-3 }, { "data": "4", "key": -12 }, { "data": "5", "key": 0 }, { "data": "10", "key": -1 } ] }
How to partially update the Razor page
The above is the detailed content of Ajax request operation returns data order. For more information, please follow other related articles on the PHP Chinese website!