title: Get value in textbox using ajax response
body: <p>I want Broker Commsion on Selection of Admin with the help of Ajax Only.</p>
  
  <pre><code>            &lt;select id="user_id"  onchange="funCom(this);" &gt;
                              &lt;option value="" &gt;Select Broker &lt;/option&gt;
                                  &lt;?php $aData=$oGeneral-&gt;get_records('tbl_user');
  
                                  $aUsertDetails  =   $oGeneral-&gt;aAdmin;
                                  $iUserDetails   =   $oGeneral-&gt;iAdmin;
                       for($i=0;$i&lt;$iUserDetails;$i++){?&gt;
                    &lt;option value="&lt;?=$aUsertDetails[$i]['fld_id']?&gt;"&gt; 
                   &lt;?php echo $aUsertDetails[$i]['fld_name']; ?&gt;&lt;/option&gt;
  
                              &lt;?php }?&gt;
                              &lt;/select&gt;
      &lt;input type="text" id="comm" name="fld_commision" value="" onkeyup="sum()" required&gt;
  </code></pre>
  
  <p>Funtion calling</p>
  
  <pre><code> function funCom(id){
    id = id.value; 
  
   Token= "search-comm";
   SendData= "Token="+Token+"&amp;id="+id;
  
  
      $.ajax({ url: 'Ajaxhandler.php', 
      dataType: 'text',
      type: 'post',
      async: false, 
      data: SendData,
      success: function(data)
      {   
  
  
          //var commision=stripHTML(data);
          //$('#comm').val(commision); again not working
          //$('#comm').text(data);  Tried this but fail   
              $('#comm').val(data); //output is &lt;body&gt;&lt;/body&gt;&lt;/html&gt;7000
                                   // i want only 7000 i have tried 
           }, 
          error: function( jqXhr, textStatus, errorThrown ){ 
          console.log( errorThrown ); 
         } });
  
  
    }
  </code></pre>
  
  <p>It is <code>Ajaxhandler.php</code>.<br>
  Here I am geting the commsion value which needs to put into textbox. The value is showing in <code>&lt;div&gt;</code> but I want in text box.</p>
  
  <pre><code>&lt;?php
  require('../configuration/configuration.php');
  $oGeneral = new GeneralClass();
  $oUser = new UserClass();
  
  $token= $_REQUEST['Token'];
  
  switch($token)  {
      case 'search-comm': $id=$_REQUEST['id'];
      $oUser-&gt;project_commision($id);
      $aUsertDetails  =   $oUser-&gt;aResults;
      $iUsertDetails  =   $oUser-&gt;iResults;
      $total=0;
      for($i=0;$i&lt;$iUsertDetails;$i++){
      $total+= $aUsertDetails[$i]['fld_commsionprice'];
  
      }
  echo $total;
  break;
  }
  
  ?&gt;
  </code></pre>