I am new to API integration. I recently integrated a vehicle VIN decoder API into my app. The VIN Decoder is from the NHTSA (National Highway Traffic Safety Administration). Once a user enters a vehicle's VIN and selects submit, data regarding that vehicle is presented in a text area.
I want to extract specific data points from the data. Specifically, I want to extract the data points: "Manufacturer" "ModelYear" "Make" "Model" "BodyClass" "DisplacementL" "EngineCylinders" "EngineHP".
I want to input this data into a table I made at the bottom of my page. So manufacturer data will be added to , model year to , and so on...
The VIN I have been using is: WBSBL93406PN63819
How can I extract the 8 specific data points I am after, and add them to the table?
Here is my code:
<!DOCTYPE html>
<html>
<head>
<title>VIN Decoder API Test</title>
<style type="text/css">
input {width: 200px;}
.border {border:1px solid black}
</style>
<script type="text/javascript" src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
$(document).ready(function() {
  $("#submit_btn").click(function () {
    var val = $("#b12").val();
    $.ajax({
        url: "https://vpic.nhtsa.dot.gov/api/vehicles/DecodeVINValuesBatch/",
        type: "POST",
        data: { format: "json", data: val},
        dataType: "json",
        success: function(result)
        {
            $("#results").val(JSON.stringify(result));
        },
        error: function(xhr, ajaxOptions, thrownError)
        {
            console.log(xhr.status);
            console.log(thrownError);
        }
    });
  })
});
</script>
</head>
<body>
  <table align="center">
      <tr>
          <td align="center">
              <input type="text" id="b12" placeholder="Enter VIN" name="b12" maxlength="100"/>
          </td>
      </tr>
      <tr>
          <td align="center">
              <button id="submit_btn">Submit</button>
          </td>
      </tr>
      <tr>
          <td>
              <textarea rows="30" cols="120" id="results" placeholder="Vehicle Data Presented Here"></textarea>
          </td>
      </tr>
  </table>
  <table class="border" align="center">
    <tr>
      <td>Manufacturer:</td> <!--"Manufacturer"-->
      <td id="t1"></td>
    </tr>
    <tr>
      <td>Year:</td> <!--"ModelYear"-->
      <td id="t2"></td>
    </tr>
    <tr>
      <td>Make:</td> <!--"Make"-->
      <td id="t3"></td>
    </tr>
    <tr>
      <td>Model:</td> <!--"Model"-->
      <td id="t4"></td>
    </tr>
    <tr>
      <td>Body Style:</td> <!--"BodyClass"-->
      <td id="t5"></td>
    </tr>
    <tr>
      <td>Displacement:</td> <!--"DisplacementL"-->
      <td id="t6"></td>
    </tr>
    <tr>
      <td>Number of Cylinders:</td> <!--"EngineCylinders"-->
      <td id="t7"></td>
    </tr>
    <tr>
      <td>Horsepower:</td> <!--"EngineHP"-->
      <td id="t8"></td>
    </tr>
  </table>
</body>
</html>Thanks so much for your help!
 
    