Commit de4748c1 authored by Charlie Jacomme's avatar Charlie Jacomme

[liste_dynamique_quick.js]Redirection si timeout pour la recherche

parent a43e1d0e
......@@ -38,7 +38,7 @@ def quick_search(request):
return HttpResponse(json.dumps(out))
else:
response = sock_ou_response
return response
return HttpResponse(u'"Erreur"')
@csrf_exempt
def get_display_info(request):
......
......@@ -20,6 +20,11 @@
- tosecondstack
**/
var href = window.location.href;
var tmpArray = href.split('/');
var fichier = tmpArray[tmpArray.length - 2];
//fichier est le nom de la page courante
/* fonction qui effectue la recherche puis appelle readData en callback */
function request(asked, callback) {
......@@ -27,6 +32,44 @@ function request(asked, callback) {
xhr.onreadystatechange = function() {
if (xhr.readyState == 4 && (xhr.status == 200 || xhr.status == 0)) {
if (xhr.responseText=='"Erreur"') {
if (fichier=='consos'){
if (!isEmpty(stack_button)) { //Soit on faisait des consos
saveStack("stack_button",stack_button)
saveStack("ordered_stack",ordered_stack)
}
if (!isEmpty(display_stack)) { //Soit on faisait des consos
for (var note in display_stack) {
delete display_stack[note]["source"]
}
saveStack("display_stack",display_stack)
saveStack("cstack",stack)
}
}
if (fichier=='consos-double'){
if (!isEmpty(stack_button)) { //Soit on faisait des consos
saveStack("stack_button",stack_button)
saveStack("ordered_stack",ordered_stack)
}
if (!isEmpty(display_stack)) { //Soit on faisait des consos
for (var note in display_stack) {
delete display_stack[note]["source"]
}
saveStack("display_stack",display_stack)
saveStack("cstack",stack)
}
if (!isEmpty(display_stack_2)) { //Soit on faisait des consos
for (var note in display_stack_2) {
delete display_stack_2[note]["source"]
}
saveStack("display_stack_2",display_stack_2)
saveStack("cstack_2",stack_2)
}
}
window.location.replace("/note/?next=%2Fnote%2F"+fichier+"%2F");
return;
}
callback(xhr.responseText);
}
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment