help with - autocomplete structure
Hello all,
I'm lost here and I really need a kind guru to help me out and to have A LOT of patience. Here is, more or less, the general workflow:
This is what I have been able to accomplish with the help of: That I'm trying to understand and adapt. //1) WHEN WILL verificaInput BE CALLED? $(document).ready(function verificaInput(inputString) { if (inputString.length == 0) { $('#sugestoes').hide(); } else { $.post('modelAutocompleteTeste.php', {nomeDominio: $('#nome-dominio').val()}, function(dadosResposta){ if(inputString.length > 3) { $('#sugestoes').show(); //2) WHAT SHOULD I PUT HERE? } }, "json" ); } }About 1): We must NOT use inline js calls ok. Where should we call/use the events like onkeyup and onblur etc... ? About 2): function(dadosResposta){ This will contain the response from our server side script, if the input string is greater then 3, it will show our suggestions... ok... Now, inside this suggestion I will need to populate some elements (<li>) containing ALL the data returned in json format from our server side script (it's php - using json_encode) ? If so, is this the proper place to loop over and create the li elements? More then answers, I would like to ask for some advices... I'm lost and stuck. Please advice, other then, "leave it a alone, and go fishing that you sure are better on that".
1 Answer
I dont know if you have looked at it at all, but you may want to consider the jquery ui autocomplete plugin. It supports all of these things and is very well documented.
Posted: MacOS 1 of 1 people found this answer helpful. Did you? Yes No |
© Advanced Web Core. All rights reserved