Below is my PHP file.
$test = array('4'=>'test','5'=>'test','1'=>'test','2'=>'test');
return array(
"status" => "test
"data" => $test
);
I am sending this array to AJAX:
$.ajax({
url: url,
type: "POST",
data: {},
success: function(result) {
if (result.status == 'test') {
console.log(result.data);
}
}
});
I am getting this output:
{1: "test", 2: "test", 4: "test", 5: "test"}
It is not getting data in the same order as I am sending from PHP. I want to get it in same order as I am sending in PHP. Any help is appreciated. Thanks in advance.