Hey all, I''m currently trying to create a script that will cache details for geocoding addresses on google maps but I''m having trouble with the onSuccess option for Ajax.Request. I''m trying to see the structure of the response variable transport but I can''t see it. I''ve tried doing other things with it as well but without know what the structure is, it is most likely that what I''ve done is wrong. This is the code I have: function getCache(address) { var params = ''address='' + address; var url = ''getCache.php''; var ajax = new Ajax.Request ( url, { method: ''post'', parameters: params, onFailure: function() { geocoder.getLocations(address, addToMap); }, onSuccess: function(transport) { xmlResponse = transport.responseXML; checkCache(xmlResponse); } } ); } getCache.php returns xml like this: <locations> <location address=''address'' lat=''latitude'' lng=''longitude'' /> </locations> I can see in firebug that I am getting the response but I can''t see anything from the transport variable. checkCache currently just dumps the structure of a variable passed through to it. Any help on this would be greatly appreciated. Nalum --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
No one have any ideas about this? On Dec 6, 11:57 am, Nalum <mallon.l...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hey all, > I''m currently trying to create a script that will cache details for > geocoding addresses on google maps but I''m having trouble with the > onSuccess option for Ajax.Request. > > I''m trying to see the structure of the response variable transport but > I can''t see it. I''ve tried doing other things with it as well but > without know what the structure is, it is most likely that what I''ve > done is wrong. > > This is the code I have: > > function getCache(address) > { > var params = ''address='' + address; > var url = ''getCache.php''; > > var ajax = new Ajax.Request > ( > url, > { > method: ''post'', > parameters: params, > onFailure: function() > { > geocoder.getLocations(address, addToMap); > }, > onSuccess: function(transport) > { > xmlResponse = transport.responseXML; > checkCache(xmlResponse); > } > } > ); > > } > > getCache.php returns xml like this: > > <locations> > <location address=''address'' lat=''latitude'' lng=''longitude'' /> > </locations> > > I can see in firebug that I am getting the response but I can''t see > anything from the transport variable. > checkCache currently just dumps the structure of a variable passed > through to it. > > Any help on this would be greatly appreciated. > > Nalum--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Nalum wrote:> ... >> onSuccess: function(transport) >> { >> xmlResponse = transport.responseXML; >> checkCache(xmlResponse); >> } >> ...What is responseXML? Isn''t responseText the attribute you need? - Ken Snyder --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
don''t forget in php header("Content-type: text/xml"); On Dec 11, 2007 10:33 AM, Ken Snyder <kendsnyder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Nalum wrote: > > ... > >> onSuccess: function(transport) > >> { > >> xmlResponse = transport.responseXML; > >> checkCache(xmlResponse); > >> } > >> ... > What is responseXML? Isn''t responseText the attribute you need? > > - Ken Snyder > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---