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:

1) The user types something on a input element;
2) Onkeyup, it will grab values from our backend script, and choose one.
3) After choosing, onblur, we will grab that value and use it to query the database for some data,
4) With the data returned from the DB he will execute other commands on an external server.
5) Then it will grab that values and use them to fill some input elements that are there waiting to be filled in, once the user chooses is option from the autocomplete element.
6) With that data in place, the user can then change the values, and hit save for yet another "ajax adventure..."

So, here, we are on steps 1) and 2) only: (so I believe)

This is what I have been able to accomplish with the help of:
http://www.nodstrum.com/2007/09/19/autocompleter/
That I'm trying to understand and adapt.

Code JavaScript:
 
//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):
Code JavaScript:
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".

M&#225;rcio