Hi Mike,
Thanks for the suggestions. As I mentioned, I have very little knowledge of 
Javascript but I see the gist of your code. I will let you know the outcome 
in due course.
Thanks again
Les Bradbury
----- Original Message ----- 
From: "Mike Williams" <[email protected]>
To: <[email protected]>
Sent: Thursday, December 03, 2009 6:24 PM
Subject: Re: Latitude and longitude to easting and northing


> What you can do is instead of having your form jump to a new page, use
> an onsubmit that takes you to a Javascript function.
>
> That function can send a request to a server and display the reply.
>
> Something like this:
>
> HTML:
>
> <form onsubmit="calculate(); return false" action="#">
>   <input type="submit" ... />
> </form>
> <div id="results"></div>
>
> Javascript:
>
> function calculate() {
>  var lat=map.getCenter().lat();
>  var lng=map.getCenter().lng();
>  var url="calculate.php?lat=" +lat+ "&lng=" +lng;
>  GDownloadUrl(url, function(reply){
>    document.getElementById("results").innerHTML = reply;
>  });
> }
>
> PHP server calculate.php:
> <?php
>  $lat = $_REQUEST["lat"];
>  $lng = $_REQUEST["lng"];
>
>  $easting = ... ;      // I assume you already have code to do
>  $northing = ... ;     // this calculation in PHP
>
>  echo $easting . "," . $northing;
> ?>
>
>
> The server sends back the result in the format that you want it to
> appear, and the client code simply drops that reply into the innerHTML
> of the awaiting div.
>
> Actually, you don't really need the form at all. You could simply call
> calculate() whenever the map "moveend" event occurs.
>
> -- 
> Mike Williams
> http://econym.org.uk/gmap
>
>
> --
>
> You received this message because you are subscribed to the Google Groups 
> "Google Maps API" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/google-maps-api?hl=en.
>
> 

--

You received this message because you are subscribed to the Google Groups 
"Google Maps API" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-maps-api?hl=en.


Reply via email to