title: Jquery:create a dictionary to autocomplete all inputs
body: <p>i want to add an smart autocomplete to my project in which when ever user is typing a word in any input its autocompleted from his own dictionary.</p>
  
  <p>his owner dictionary is built by saving every word he ever submit to server something like (array_values($_POST))</p>
  
  <p>my current JS</p>
  
  <pre><code>$('input.complete').live('keyup.autocomplete', function(){
          var hi=$(this).val().toUpperCase();
          var was=this;
          $(this).autocomplete({
  //PROBLEM Should i consider to change source from ajax/mysql to different source ?
  //since there gona be too many requests ??
              source: function(request, response) {
                      $.ajax({ url: '&lt;?=base_url()?&gt;ajax/ac',
  //PROBLEM how can i set term=word currently being edited..(start=' ',end=pointerpos)
                      data: { 'term': this.term },
                      dataType: "json",
                      type: "POST",
                      success: function(data){
                          if(data.length){
                              //response(data);
            //Commented out cause i dont wana display dropdown.. just typeahead.
                                if(data[0]['value'].substr(0,hi.length).toUpperCase()==hi){
                                  $(was).val(data[0]['value']);
  //currently working with single word inputs..once i get how to select only current word will edit these..
                                  was.selectionStart=hi.length;
                                  was.selectionEnd=data[0]['value'].length;   
                              }
                          }
                      }
                  });
              },
              select: function(event, ui){},
              minLength: 2,
              delay: 500
          });
  </code></pre>
  
  <p>As u can see i have 2 problems</p>
  
  <p><strong>Question</strong></p>
  
  <ol>
  <li>how can i select current word that user is typing ?</li>
  <li>is this a good approach to reach my goal, or i should consider different plugin</li>
  </ol>