Get the output of a function..


Hello :D
Im 100% noob to javascript..

now, i have this script:

if(navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function(position) {
document.write(position.coords.latitude + '_' + position.coords.longitude);

and i need to send the location data to a php script..
Is there any easy and smart way to do souch things?

The easy way will be to redirect to ?data=OUTPUT FROM GEOLOCATION FUNCTION
But how do i do that??

i have tried this, without success:

<script> if(navigator.geolocation) { navigator.geolocation.getCurrentPosition(function(position) { window.location=(" + '_' + position.coords.longitude");

But it just send me to a page named:'_'%20+%20position.coords.longitude

i want it to send me to:

How do i do that?? :D

Regards Lasse

Featured Replies in this Discussion

  • ... It's because u put it in quotation marks as a string. Change it to ... That should do it.
    Post Contains: Links Code

Thank you mann..

it works :D


Np, mark the question solved please!

Question Answered as of 2 Years Ago by NardCake
This question has already been solved: Start a new discussion instead
Start New Discussion
Tags Related to this Article