diff options
| author | Daniel Friesel <derf@finalrewind.org> | 2016-05-11 22:54:29 +0200 | 
|---|---|---|
| committer | Daniel Friesel <derf@finalrewind.org> | 2016-05-11 22:54:29 +0200 | 
| commit | c0f9ce8253c837acbfb5c7e431f569a2dc247ab9 (patch) | |
| tree | 18809da2f72a080926a678dd55497ffe86017aaf | |
| parent | 7c62efcbdce785f77f48e56ce7876a496e6cce89 (diff) | |
public geolocation json format
| -rw-r--r-- | index.pl | 12 | ||||
| -rw-r--r-- | public/static/geolocation.js | 6 | 
2 files changed, 14 insertions, 4 deletions
@@ -826,8 +826,18 @@ post '/_geolocation' => sub {  		$self->render(json => {error => 'Invalid lon/lat received'});  	}  	else { +		my @candidates = map { +			{ +				ds100 => $_->[0][0], +				name => $_->[0][1], +				eva => $_->[0][2], +				lon => $_->[0][3], +				lat => $_->[0][4], +				distance => $_->[1], +			} +		} Travel::Status::DE::IRIS::Stations::get_stations_by_location($lon, $lat, 10);  		$self->render(json => { -			candidates => [ Travel::Status::DE::IRIS::Stations::get_stations_by_location($lon, $lat, 10) ], +			candidates => [ @candidates ],  		});  	}  }; diff --git a/public/static/geolocation.js b/public/static/geolocation.js index 6e5fdb5..f34e1e1 100644 --- a/public/static/geolocation.js +++ b/public/static/geolocation.js @@ -18,9 +18,9 @@ $(document).ready(function() {  		} else {  			$.each(data.candidates, function(i, candidate) { -				var ds100 = candidate[0][0], -					name = candidate[0][1], -					distance = candidate[1]; +				var ds100 = candidate.ds100, +					name = candidate.name, +					distance = candidate.distance;  				distance = distance.toFixed(1);  				var stationlink = $(document.createElement('a'));  | 
