title: Laravel 5.2 Ajax Returns me undefined value, im doing an edit modal using ajax
body: <p>i need to show the values depending on the id, here is my button trigger for the edit, the jquery returns me a result when i console.log(result) it gives me data, but when i do console.log(result.company_name) and console.log(result[0].company_name) it gives me undefined, i tried many ways but still not working pls help, im trying to put the value in the modal input field</p>
  
  <pre><code>&lt;button onclick="editClient({{$v-&gt;id}})" data-toggle="modal" data-
  target="#editClientModal"&gt;&lt;/button&gt;
  </code></pre>
  
  <p>here is my jquery ajax </p>
  
  <pre><code> function editClient(id){
    var client_id = id;
    $.ajax({
      url: "{!!URL::to('/clients/edit')!!}/"+client_id,
       success: function( result ) {
         console.log(result.company_name);
         $("#company_name").val(result.company_name);
       }
     });
   }
  </code></pre>
  
  <p>here is my edit function in the controller</p>
  
  <pre><code>function getEditClient($id){
      $data = DB::table('clients')-&gt;find($id);
  
      return json_encode($data);
  }
  </code></pre>