title: Fetch Data in a form through Ajax in Laravel
body: <p>I am making an auto-complete form, in which user enter only the id and the whole information related to that id comes in other field. I am using ajax and Laravel 5.4. The Data is coming in alert but how i can insert data in input fields of a form. Here is my script:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
   $('#submitid').on('click', function() {
  
      var vid = $( "#vid" ).val();
         //var id=$(this).data('id');
  
          $.ajax({
                url: '/inquiryVendor',
                type: "Get",
                data:{id:$("#vid").val()}, // the value of input having id vid
                 success: function(response){ // What to do if we succeed
  
              alert(response); console.log(response);
  
  
          }
              });
      });
  &lt;/script&gt;
  </code></pre>
  
  <p>this is my controller:</p>
  
  <pre><code>public function VendorDetail(Request $request)
      {
  
      $id= $request-&gt;id;
  
        $data = DB::select(DB::raw("SELECT * from bp where id = '$id'"));
        echo json_encode($data);
  
      }
  </code></pre>
  
  <p>here is my console.log response:</p>
  
  <pre><code>[{"id":37,"card_name":"Maka Furniture Co.,Ltd ","trade_type":"Manufacturer","address":"Xinzhang development zones,Shengfang town,Hebei province.","fc":"121AC209","status":0,"created_at":"2018-10-10 10:02:27","user":"admin"}]
  </code></pre>
  
  <p>here is the screenshot of response:</p>
  
  <p><a href="https://i.stack.imgur.com/NGx8p.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NGx8p.jpg" alt="enter image description here"></a></p>
  
  <p>Any help would be highly appreciable. </p>