<script type="text/javascript">
var geo = new GClientGeocoder();
function showAddress() {
var search = document.getElementById("search").value;
// getLocations has not ret, so wtf!
geo.getLocations(search, function (result) { (result.Status.code == 200) ? alert(result.Placemark[0].Point.coordinates) : alert(result.Status.code); });
}</script>
I need the ret value of the callback as getLocations() returns no values. How can I do this?
You can’t. You have to write your code in such a way that the code that needs the
resultvalue is executed in the callback.Example (I just named the function in a way which seems logical to me):