Closed rejustify closed 4 years ago
The script works great but when mod_rewrite is on, after selecting an item from the list, the script submits the form by default, redirecting to the next page. It is quite tricky to set preventDefault on the form:
$('.item').autoComplete({ resolver: 'custom', formatResult: function (item) { return { value: item.id, text: item.desc + " [" + item.name + "] " }; }, select: function(e){ e.preventDefault(); } events: { search: function (qry, callback, origJQElement) { $.ajax({ type: "POST", url: "search.php", data: { 'qry': qry}, dataType: "json" }).done(function (res) { callback(res.results); }); } }, });
Duplicate of #37
The script works great but when mod_rewrite is on, after selecting an item from the list, the script submits the form by default, redirecting to the next page. It is quite tricky to set preventDefault on the form: