title: jQuery autocomplete with AJAX JSON
body: <p>I'm trying to have dynamic autocomplete values for a textbox.</p>
  
  <p>This is my response:</p>
  
  <p><code>echo json_encode($res)</code></p>
  
  <pre><code>0: {type_name: "name1"}
  1: {type_name: "name2"}
  2: {type_name: "name3"}
  3: {type_name: "name4"}
  4: {type_name: "name5"}
  </code></pre>
  
  <p>And this is my autocomple ajax code:</p>
  
  <pre><code> $( "#txt_box" ).autocomplete({
    source: function( request, response ) {
        $.ajax({
          type:"POST",
          url: "index.php?action=autocomplete",                   
          dataType: "json",
          data: {
              q: request.term
          },
          success: function( data ) {
              response( data );
          }
      });
    }
   });    
  </code></pre>
  
  <p>I'm not able to figure out if there is any issue in my JSON format or in my AJAX code. I'm not able to get the autocomplete dropdown based on the keysearch.</p>