I was wondering how to add a html link to each JSON item as it is returned.
php file
//relevant code, $result contains sql query with records from a search
$records = array();
while($array = mysqli_fetch_array($result))
{
$records[] = $array;
}
echo(json_encode($records));
Output html via ajax
function responseReceived(e){
document.getElementById('response').innerHTML = e.target.responseText;
}
Response is a div tag. So I was wondering how would I add html link (to another page) to each item within the json. Because at the moment it outputs json but it's not allowing me to add html.
This is the current output, which is as expected due to me entering data via a form, I just want to add a small html link next to him.
[{"0":"1115","ID":"1115","1":"john","name":"john","2":"male","type":"male","3":"berk","country":"berk","4":"aus","region":"aus","5":"32.43","lon":"32.43","6":"32.54","lat":"32.54","7":"nothing to say","description":"nothing to say"}]
Thanks, in advance.