Best way to Integrate a Javascript result with PHP

Superbmir

New Member
Ok.Basically I am utilizng the Google Maps API - It is Javascript.My site runs off PHP for the most part.My intention is to make calls to the Google Maps API to get the distance between various already geocoded longitude and latitude points. I then want to display them to my users.An example.I have (in php):\[code\]$home=array(latitude,longitude); \[/code\]I also have a mysql_query result from my database of locations.As such I do\[code\]while($result=mysql_fetch_array($results)){//OUTPUT THE GOOGLE MAPS JAVASCRIPT JARGON WHICH WILL FIND THE DISTANCE//BETWEEN MY HOME AND THE DB LOCATIONS}\[/code\]In the example code the value is simply outputted to a div by setting the inner html of a specified div to the response value of a certain query (this is where my JS knowledge gets hazy).Ideally I want to get this value into a php var.Is there anyway of doing:\[code\]$var=response from js thing;\[/code\]What I have done at the moment is essentially using php I have generated the correct number of divs with names 'response1','response2' etc which the JS populates.. but this does not seem like the most logical way of doing things.Hope that makes sense.Thanks
 
Back
Top