Small improvements

* Now displaying a loading page while loading position search results
* Now tells the user if there isn't any result for a position search.
This commit is contained in:
Phyks 2013-08-01 14:50:29 +02:00
parent 1602f5dcc2
commit b1cc43a29a
1 changed files with 29 additions and 5 deletions

24
js.js
View File

@ -437,6 +437,25 @@ window.onload = function() {
{
var json = JSON.parse(xhr.responseText); //Parse the response
if(json.length == 0)
{
var params_url_wo_position = '';
for(GET in params) //Define hidden input to keep params
{
if(GET != '' && GET != "position")
{
if(params_url_wo_position != '')
params_url_wo_position += '&';
params_url_wo_position += GET+'='+params[GET];
}
}
document.getElementById("position").innerHTML = "<p>Aucune correspondance n'a été trouvée. <a href='index.php?"+params_url_wo_position+"'>Revenir en arrière</a></p>";
}
else
{
latitude = json[0].lat;
longitude = json[0].lon;
@ -447,6 +466,11 @@ window.onload = function() {
}
}
}
else
{
document.getElementById("position").innerHTML = "<p>Chargement en cours...</p>";
}
}
}
xhr.open("GET", lat_long_provider+"?format=json&q="+encodeURI(position+", Paris, France"), true); //xhr handle the data about stations