Is there a way to pass javascript variables in url? -


is there way make below script pass javascript values url of 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> 

try this:

 window.location.href = "http://www.gorissen.info/pierre/maps/googlemaplocation.php?lat="+elema+"&lon="+elemb+"&setlatlon=set"; 

to put variable in string enclose variable in quotes , addition signs this:

var myname = "bob"; var mystring = "hi there "+myname+"!";  

just remember 1 rule!


Comments

Popular posts from this blog

curl - PHP fsockopen help required -

HTTP/1.0 407 Proxy Authentication Required PHP -

c# - Resource not found error -