How to reload json from remote using jQuery UI? -
i have search form loads suggestions remote:
$form.autocomplete({ source: routing.generate('hn_search_suggest'), minlength: 2 });
when enter word, , 1 request term
parameter. yet if delete and/or delte input , restart typing new one, reload json repsonse.
can configure jqueryui autocomplete reload suggestion list source?
you can make autocomplete data controller using source property:
$("#myfield").autocomplete({ source: function (request, response) { // request.term term searched for. // response callback function must call update autocomplete's // suggestion list. $.ajax({ url: "/my_url/myservice.xyz", data: { q: request.term }, datatype: "json", success: response, error: function () { response([]); } }); }); });
this callback server every time type it, reloading source.
Comments
Post a Comment