title: Jquery - Remove Tags and add Tags dynamically using [aehlke] multitags plugin
body: <p>I am using tagit plugin (<a href="https://github.com/aehlke/tag-it" rel="nofollow">https://github.com/aehlke/tag-it</a> "Tagit Plugin aehlke") and auto-complete feature. I have to change tags based on the selection made using the auto-complete feature.</p>
  
  <p>It worked for the first selection but not for the second one .</p>
  
  <p>I removed the existing tags - using 'removeAll" in tagit plugin and did tagit() - doesn't work ??</p>
  
  <p>This is my code :</p>
  
  <pre><code>&lt;script&gt;
  
      $(document).ready(function()  {
          var allKeyWordsString=" ";
              $.ajax({
                  url : some url,
                  type : 'GET',
                  //data : "query="+$("#query").val(),
                  async : false,
                  cache : false,
                  contentType : "application/x-www-form-urlencoded",
                  processData : false,
                  success : function(returndata) {
  
                      allKeyWordsString = returndata.success;
                      alert("keywords are "+ allKeyWordsString);
                  }
              });
  var sampleTags = allKeyWordsString.split(',');   
  
        $("#keyWordForm").autocomplete({
        source: sampleTags,
        minLength : 3,
  
        select: function(event,ui){
          var selectedKeyWord = ui.item.value;
  
  
          var services = " ";
              $.ajax({
                  url : 'some url',
                  type : 'GET',
                  data : "query="+selectedKeyWord+" services",
                  async : false,
                  cache : false,
                  contentType : "application/x-www-form-urlencoded",
                  processData : false,
                  success : function(returndata) {
                      services = returndata.success;
                      alert(" ajax call response is "+services);
                  }
              });
              if ($('#servicesForm').val().length != 0){
              $('#servicesForm').tagit('removeAll');
              }
              document.getElementById("servicesForm").value=services;         
  
              $('#servicesForm').tagit();
        }
      });     
  
  return false;
          });
  &lt;/script&gt;
  </code></pre>
  
  <p>Please help</p>