I am working on google maps api where i have to calculate the distance from current location to user selected destination. The list of destinations are stored in javascript array as:
var details = [
{
'title': 'Sobo Central Mall',
'address': 'PTMM Malvia Marg,Tardeo Road,Mumbai.',
'lat': '18.975684',
'lng': '72.811910',
'open': 'NA',
'close': 'NA',
'sex': 'Unisex',
'place': 'mall'
}
//and so on...
];
which I display in list:
for (i = 0; i < details.length; i++) {
var place= details[i].title;
var add= details[i].address;
document.getElementById('list').innerHTML +='<p>'+ place+ '<br><div id="address"> ' + add +'</div></p><br/><hr/>';
here i want to call the another php i.e.direction.php
file to which i can pass add
variable
<a href="direction.php?add="+add+">dir</a>
And in direction.php:
<?php $add = $_GET['add'];?>
<script>
document.getElementById('desti').innerHTML = "<?php echo $add ?>";
</script>
But $add
doesn't have any value in it.
Can anyone sort out the error?or suggest any different way to pass the js variable to another php file.