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
34
js.js
34
js.js
@ -437,15 +437,39 @@ window.onload = function() {
|
||||
{
|
||||
var json = JSON.parse(xhr.responseText); //Parse the response
|
||||
|
||||
latitude = json[0].lat;
|
||||
longitude = json[0].lon;
|
||||
if(json.length == 0)
|
||||
{
|
||||
var params_url_wo_position = '';
|
||||
|
||||
if(latitude == 0 && longitude == 0)
|
||||
document.getElementById("position").innerHTML = "<p>Une erreur a été rencontrée. Veuillez réessayer.</p>";
|
||||
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
|
||||
getBikes(latitude, longitude);
|
||||
{
|
||||
latitude = json[0].lat;
|
||||
longitude = json[0].lon;
|
||||
|
||||
if(latitude == 0 && longitude == 0)
|
||||
document.getElementById("position").innerHTML = "<p>Une erreur a été rencontrée. Veuillez réessayer.</p>";
|
||||
else
|
||||
getBikes(latitude, longitude);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
document.getElementById("position").innerHTML = "<p>Chargement en cours...</p>";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user