Why dont you pass array with ajax?
Like make an array in php code, and pass it in encoding form, eg.
echo json_encode($arrResult);
than in html form again parse it with parseJSON()
.
eg. of ajax call for your reference
$.ajax({
type: "POST",
url: "phpfile.php",
}).done(function( msg ) {
//alert(msg);
msg = $.trim( msg );
if(msg != '[]'){
var obj = jQuery.parseJSON(msg);
$("#lga").html('');
$("#lg").text(obj.value2);
$("#lgi").text(obj.value3);
$("#lgv").text(obj.value4);
$("#lgc").text(obj.value5);
$("#lt").text(obj.value6);
}// if
});
in phpfile.php, your array should be
$returnArray[value2] = 'abc';
$returnArray[value3] = '234';
$returnArray[value4] = 'xyz';
$returnArray[value5] = 'pqr';
$returnArray[value6] = '987';
echo json_encode($returnArray);
solved Using $.ajax to get more values from php