|
@@ -31,6 +31,8 @@
|
31
|
31
|
options.form_name = "{{ form_name }}";
|
32
|
32
|
options.tag_init = taginit;
|
33
|
33
|
|
|
34
|
+ ajax_query_timestamp = null;
|
|
35
|
+
|
34
|
36
|
$("#tags_prompt_list_{{ form_name }}").tagBox(options);
|
35
|
37
|
|
36
|
38
|
// On détruit la variable taginit
|
|
@@ -55,9 +57,16 @@
|
55
|
57
|
// ici il faut faire une ajax q pour obtenir la liste
|
56
|
58
|
// ou a est un tableau de strings
|
57
|
59
|
$('#tag_loader_{{ form_name }}').css('display', 'block');
|
58
|
|
- $.getJSON('/app_dev.php/fr/search/tag/'+req.term, function(data) {
|
59
|
|
- responseFn( data );
|
60
|
|
- $('#tag_loader_{{ form_name }}').css('display', 'none');
|
|
60
|
+ ajax_query_timestamp = new Date().getTime();
|
|
61
|
+ $.getJSON('/app_dev.php/fr/search/tag/'+req.term+'/'+ajax_query_timestamp, function(data) {
|
|
62
|
+
|
|
63
|
+ // Ce contrôle permet de ne pas continuer si une requete
|
|
64
|
+ // ajax a été faite depuis.
|
|
65
|
+ if (data.timestamp == ajax_query_timestamp)
|
|
66
|
+ {
|
|
67
|
+ responseFn( data.data );
|
|
68
|
+ $('#tag_loader_{{ form_name }}').css('display', 'none');
|
|
69
|
+ }
|
61
|
70
|
});
|
62
|
71
|
},
|
63
|
72
|
minLength: 2,
|