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:
parent
1602f5dcc2
commit
b1cc43a29a
24
js.js
24
js.js
@ -437,6 +437,25 @@ window.onload = function() {
|
|||||||
{
|
{
|
||||||
var json = JSON.parse(xhr.responseText); //Parse the response
|
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;
|
latitude = json[0].lat;
|
||||||
longitude = json[0].lon;
|
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
|
xhr.open("GET", lat_long_provider+"?format=json&q="+encodeURI(position+", Paris, France"), true); //xhr handle the data about stations
|
||||||
|
Loading…
Reference in New Issue
Block a user