My work host has an old version of PHP and it's not supporting json_encode(), so I need another way to pass array of strings from PHP to JavaScript, can't figure out how.... please help.
This is my current working code that's needed "downgrade":
PHP:
$arr = array($first_name,$last_name, $phone, $email, $number);
echo json_encode($arr);
JAVASCRIPT (ignore the missing brackets):
function get_repeat_request_details(request_id){
if (window.XMLHttpRequest)
{
xmlhttp=new XMLHttpRequest();
}
else
{
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200){
var arr = JSON.parse(xmlhttp.responseText);
document.getElementById("tb_f_name").value = arr[0];
document.getElementById("tb_l_name").value = arr[1];
document.getElementById("tb_phone").value = arr[2];
document.getElementById("tb_email").value = arr[3];
document.getElementById("tb_number").value = arr[4];