Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 14th, 2012  |  syntax: JavaScript  |  size: 0.72 KB  |  hits: 16  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. exports.getFilialen = function(type){
  2.         var url = 'https://maps.googleapis.com/maps/api/place/search/' +
  3.                           'json?location=50.82718,3.26974&radius=1000&rankby=prominence&types='
  4.                            +type+
  5.                           '&sensor=false&key=AIzaSyDUI4VO4N8hLeTJw7cQxNqiPSQYdlySJLI';
  6.                          
  7.         var data;
  8.        
  9.         var xhr = Ti.Network.createHTTPClient({
  10.                 onload : function(e) {
  11.                         data = JSON.parse( this.responseText );
  12.             for( filiaal in data ){
  13.                 Ti.API.info('filiaal: ' + filiaal.results );
  14.             }
  15.            
  16.            
  17.            
  18.         },
  19.         onerror : function(e) {
  20.             Ti.API.debug(e.error);
  21.             Ti.API.info('onerror: ' + error);
  22.         },
  23.         timeout: 5000
  24.         });
  25.        
  26.         xhr.open( 'GET', url );
  27.         xhr.send();
  28. };