That makes perfect sense, I tried this but I think Im missing
something....
$("form").bind("submit", function()
{
var name = document.form.name.value;
var phone = document.form.phone.value;
var address1 = document.form.address1.value;
var address2 = document.form.address2.value;
var address = address1 + address2;
geocoder = new GClientGeocoder();
if (geocoder) {
geocoder.getLatLng(
address,
function(point) {
if (!point) {
alert("no point");
}
else
{
$.post("backend.php",
{
name: name,
phone: phone,
address1: address1,
address2: address2,
latlong: point,
method: "newFood"
},
function(data,textstatus){
alert(data.message);
if (data.refresh == "true")
{
window.location =
"http://p1.dpn.homeip.net/content/results.php?
id=<?echo $sort2?>"
}
}, "json"
);
}return false;
}
);
}
});
On May 30, 10:23 pm, Rossko <[email protected]> wrote:
> > But I get an undefined result. After some time I can get a proper
> > result.
>
> Yup.
> http://econym.org.uk/gmap/async.htm
>
> > How do I get the code to wait for a valid result?
>
> You don't. You put the code that needs to 'do something' with the
> result in the getLatLng callback function.
>
> cheers, Ross K
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---