title: Add ajax success return json object data in html form
body: <p>I have created form to add data in php-mysql database with ajax,
  It is working fine, after data is added it shows in html table.</p>
  
  <p>Now i am trying to create code for editing those entry,
  I had created code as below for edit with AJAX,</p>
  
  <pre><code>$(document).ready(function() {
  var table = $('#categorylist').DataTable();
  
  $('#categorylist tbody').on( 'click', 'tr', function () {
      $(this).toggleClass('selected');
  } );
  
  $('#edit_category').on( 'click',function () {
      document.getElementById('editcategory').style.display = "block";
  
  
  
      /*do some task here to get values of ID*/
  var catid = $("#cat_id").val();
  
  
              jQuery.ajax({
                          url: "&lt;?php echo base_url(); ?&gt;index.php/tools/edit_category",
                          data: {category:catid},
                          type: "POST",
                          success:function(data){ 
                          var objData = jQuery.parseJSON(data);
                              console.log(objData);
                              $("#cname").html(
                                  objData.category_name
                                              );
  
  
                                      }
                          });
  
  });
  });
  </code></pre>
  
  <p>Above code will send request to PHP to get information for that ID and return me data in json format,
  Below is returned data,</p>
  
  <p>category_id: "38"
  category_name: "Test Conveyance"</p>
  
  <p>Now i want to show this values in html form so that user can see what are current values, then user will edit values and click on save.</p>
  
  <p>Below is my html form, how can i show category ID and name in html input form as value?</p>
  
  <p>Thanks,</p>
  
  <pre><code>&lt;form action="" method="post" accept-charset="utf-8" id="category_editform"&gt;
                              &lt;div class="form-group"&gt;
  
                                &lt;div class="controls"&gt;
                                &lt;div class="input-group m-t-20 icons-panel"&gt; &lt;span class="input-group-addon bg-white"&gt; &lt;i class="fa fa-list"&gt;&lt;/i&gt; &lt;/span&gt;
                           &lt;input type="text" class="form-control" name="category_name" placeholder="category name" id="cname" required&gt;
                          &lt;/div&gt;
  
                                &lt;/div&gt;
                              &lt;/div&gt;
                              &lt;div class="align-left"&gt;
                                &lt;input type="submit" class="btn btn-primary m-r-20" name="create_category" value="Save"&gt;
                                &lt;button type="reset" class="btn btn-default" onClick="expensecategory_editform_hide()"&gt;Cancel&lt;/button&gt;
                              &lt;/div&gt;
  
                            &lt;/form&gt;
  </code></pre>