title: jQuery Tokeninput add input on click
body: <p>I am using jQuery Tokeninput and works perfectly. I let user select category from the Tokeninput box. Now, I need to put a button which will open a popup screen and it will let user to insert a new category to Database. After user inserts the new category, popup will close and I want that new category be in the Tokeninput box as a token.</p>
  
  <p>here is my code,</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  $(document).ready(function () {
      $("#demo-input-facebook-theme").tokenInput("http://iyihekim.com/MedBulCategory_Service.aspx", {
  
          onAdd: function (item) {
              $.cookie("Kat_" + item.name, item.id);
          },
          onDelete: function (item) {
              var date = new Date();
              date.setTime(date.getTime());
              $.cookie("Kat_" + item.name, item.id, { expires: date });
          },
  
          theme: "facebook"
  
      });
  });
  </code></pre>
  
  <p></p>
  
  <p>I know that if I add prepopulate function as below, It will create it on Load but I want to call that function after popup box closes</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  $(document).ready(function () {
      $("#demo-input-facebook-theme").tokenInput("http://iyihekim.com/MedBulCategory_Service.aspx", {
           // added this***************************
          prePopulate: [
              {id: 123, name: "Slurms MacKenzie"},
              {id: 555, name: "Bob Hoskins"},
              { id: 9000, name: "Kriss Akabusi" }],
  
          onAdd: function (item) {
              $.cookie("Kat_" + item.name, item.id);
          },
          onDelete: function (item) {
              var date = new Date();
              date.setTime(date.getTime());
              $.cookie("Kat_" + item.name, item.id, { expires: date });
          },
  
          theme: "facebook"
  
      });
  });
  </code></pre>
  
  <p></p>
  
  <p>Please help</p>