passing variable ..

passing variable ..

hi i have a problem when i try to pass variable in javascript or maybe this is jquery matter

i'm using tokenize plugin from this site :

http://loopj.com/2009/04/25/jquery-plugin-tokenizing-autocomplete-text-entry/

problems comes when i about to set a predefined value for the token, if i use static variable like this script its working ok
  1. $("#tokenize2").tokenInput("http://localhost/ci/index.php/skripsi/adminPanel/listPeserta/", {
  2. prePopulate: [{ "id":"1","name":"Populated Name 1" },{ "id":"2","name":"Populated Name 2" }],
  3. hintText: "Ketik nama untuk menambahkan",
  4. noResultsText: "Tidak ada data",
  5. searchingText: "Sedang mencari..."
  6. });
and my goal is to change prePopulate to a dynamic variable, so i try use this code :

  1.              $.ajax({
  2.                 type:"POST",
  3.                 url:"http://localhost/ci/index.php/skripsi/adminPanel/pesertaUndangan/",
  4.                 data: info2,
  5.                 dataType: 'json',
  6.                 success:function(data){                    
  7.                         var resultPopulate = data;
  8.                 }
  9.               });

  10. $("#tokenize2").tokenInput("http://localhost/ci/index.php/skripsi/adminPanel/listPeserta/", {
  11. prePopulate: resultPopulate,
  12. hintText: "Ketik nama untuk menambahkan",
  13. noResultsText: "Tidak ada data",
  14. searchingText: "Sedang mencari..."
  15. });
but this script result is "resultPopulate undefined" is there any idea about this ?