I have a branch locator script that works when you load it from the same page as the embedded Google map from the Google Maps API, but I can't query it from another page.
The problem is I want to be able to search from the the home page and have the store locator page with the map on it as an action page which then shows the branches as results.
The script is javascript and loads the results from an xml file which has database results in it. I managed to get it to accept a $_GET['search'] string and then load the function that returns the results using the search string.
I can't understand why the results only show when the page is refreshed and not the first time it loads.
<script type="text/javascript">
function getURLParameter(name) {
return decodeURI(
(RegExp(name + '=' + '(.+?)(&|$)').exec(location.search)||[,null])[1]
);
}
var urladdress = getURLParameter(name) ;
function initAddress(){
document.getElementById("addressInput").value=urladdress;
searchLocations();return false;
}
document.ready = initAddress;
</script>