javascript - Cannot collect alle results of asynchronous call with geo.getLocations (Google Maps) -


itemprop = "text">

The problem is that my code is down [0] always undefined, whatever I try.

I know that there is nothing to do with this callback result. I tried to add some delay, so that it would be given more time to give results, but she did not help from that.

Any ideas (for example please)? much appreciated.

  function getAddress (id, searchValue) {geo.getLocations (searchValue, function (result) {if (result.Status.code == G_GEO_SUCCESS) {var recordsOutStr = id + ';' + SearchValue + ';'; (; j & lt; result.Placemark.length; J ++ j j = 0) recordsOutStr + = result.Placemark [J] .address + ',' + result.Placemark [J] .Point.coordinates [0] + ',' + result.placemark [j] .point.coordinates [1]; recordsOut.push (recordsOutStr); Warnings (recordsOutStr);} else {var cause = "code" + result Status.code, if (causes [result.Status.code]) causes = causes [result.Status.code] warning ('could not find' '+ searchValue +' "'+ cause);}}); } Function Delay (MS) {var date = new date (); Var curDate = null; Do {curDate = new date (); } While (curDate - Date & lt; ms); } Function process data () {objDataIn = document.getElementById ("data in"); ObjDataOut = document.getElementById ("DataAut"); If (objDataIn! = Null) {//alert(objDataIn.value}; if (objDataOut! = Tap) {recordsIn = explosion (objDataIn.value, ';', true); for (i = 0; i & lt ;;;;;;;); [I] in [record] ['] [' address'] + ',' + record [i] '['] '' [']', 'Record' [']' ['city'] ',' + recordIn [i] ['country']; GetAddress (record [i] ['id'], addressstrate); / The result will set the return delay (200);} delay (5000); alerts ('***' + record [0] + '***'); alerts ('***' + record [1] + '***'); Alert ('***' + [2] + '***' in the records; alerts ('***' + record [3] + '***'); Warning ( '***' + in the records [4] + '***');}} Document.frmGeoCoder.submit ();}  

Make sure that you have already defined defined by:

  var recordout = [];  

If you do this var records oyet; - This will be undefined.

If this does not work for you, please post the rest code, so we can see what's going on is.


Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -