Is there a way to pass javascript variables in url?
javascript, url
Solution
Try this:
window.location.href = "http://www.gorissen.info/Pierre/maps/googleMapLocation.php?lat="+elemA+"&lon="+elemB+"&setLatLon=Set";
To put a variable in a string enclose the variable in quotes and addition signs like this:
var myname = "BOB";
var mystring = "Hi there "+myname+"!";
Just remember that one rule!
Problem
Is there a way to make the below script pass the javascript values to the url of the href link? ``` <script type="text/javascript"> function geoPreview(lat,long) { var elemA = document.getElementById("lat").value; var elemB = document.getElementById("long").value; window.location.href = "http://www.gorissen.info/Pierre/maps/googleMapLocation.php?lat=elemA&lon=elemB&setLatLon=Set"; } </script> ```