how to start jquery autocomplete immediatey after my ajax call to server
<p>I've got a big database with over 30,000 answers! I bind a keyp event to my textbox to search if the input value length is 3, so I make an ajax call to the server getting the records from database which start with these 3 character and then I start jquery autocomplete with source - the data from database but the problem is when the user enters three characters, I get the source for the autocomlete only when he enters the fourth character the autocomplete starts. Is it possible to change that behaviour and as soon you enter 3 characters to start autocomplete</p>

<p>Thanks in advance </p>

<p>My code</p>

<pre><code>var keypresshandler = function () 


{


        var  strin = document.getElementById('txtInput').value;
        newstr = strin.replace(/[^\u0400-\u04FF0-9]/gi, '');


        if (newstr.length&lt;3)
        {
                $( "#txtInput" ).autocomplete( "destroy" );
        }


        else 

            if (newstr.length==3)
            {    

                 triming();

            }



    }


    $(function() 
    {    
         $('#txtInput').bind('keyup', keypresshandler);     


    });



    function triming()
    {


         xmlhttp.onreadystatechange = function() 
        { 
            if (xmlhttp.readyState==4 &amp;&amp; xmlhttp.status==200) 
            {
                alert(xmlhttp.responseText);

                var xmlObj = xmlhttp.responseXML;   
                var textXML = xmlObj.documentElement.firstChild.firstChild.nodeValue;


                if (window.DOMParser)
                {
                    parser=new DOMParser();
                    var xmlDoc=parser.parseFromString(textXML,"text/xml");
                }
                else // Internet Explorer
                {
                    var xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
                    xmlDoc.async=false;
                    xmlDoc.loadXML(textXML);
                }

                var rows = xmlDoc.getElementsByTagName("row");
                rowsn = rows.length;
                for (i=0;i&lt;rowsn;i++)
                {   
                    var cols=rows[i].getElementsByTagName("colunm");
                    colsn=cols.length;


                    for (var j=0; j&lt;colsn; j++)
                    {   

                        mec[i] = cols[j].getAttribute("colvalue");

                    }

                } 
               // alert (rec.length);   

               $( "#txtInput" ).autocomplete({source: mec});


            }

        }


        var url = "http://localhost:9091/localbusscat/services/localbusscat/FindEl?myel="+ encodeURIComponent(newstr);
    //  alert (url);
        xmlhttp.open("GET", url, true);
        xmlhttp.send(); 

    }
</code></pre>
