{"size": 1502, "ext": "js", "max_stars_repo_path": "public/js/nhtsa.js", "max_stars_repo_name": "amnasyeda/vehicle-app", "max_stars_repo_stars_event_min_datetime": "2020-02-04T18:27:19.000Z", "max_stars_repo_stars_event_max_datetime": "2020-02-04T19:42:46.000Z", "max_issues_repo_path": "public/js/nhtsa.js", "max_issues_repo_name": "amnasyeda/vehicle-app", "max_issues_repo_issues_event_min_datetime": "2020-02-04T18:55:01.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-13T05:41:21.000Z", "max_forks_repo_path": "public/js/nhtsa.js", "max_forks_repo_name": "amnasyeda/vehicle-app", "max_forks_repo_forks_event_min_datetime": "2020-03-09T16:23:20.000Z", "max_forks_repo_forks_event_max_datetime": "2020-03-09T16:23:20.000Z"}
{"max_stars_count": 4, "max_issues_count": 18, "max_forks_count": 1, "avg_line_length": 40.5945945946, "max_line_length": 165, "alphanum_fraction": 0.482023968}
$(document).ready(function () {
    $("#nhtsa-btn").click(function () {
        var make = $("#userMake").val();
        var model = $("#userModel").val();
        var year = $("#userYear").val();
        recallSearch(make, model, year);
    });

    function recallSearch(make, model, year) {

        $.ajax({
            url: `https://cors-ut-bootcamp.herokuapp.com/https://one.nhtsa.gov/webapi/api/Recalls/vehicle/modelyear/${year}/make/${make}/model/${model}?format=json`,
            type: "GET",
        }).done(function (response) {
            $("#recallResults").empty();
            console.log(response);
            if (response.Count == 0) {
                $("#recallResults").append("No recalls found.");
            } else {
                for (let index = 0; index < response.Results.length; index++) {
                    const recall = response.Results[index];
                    let batman = `
                <div>
                <p class = "recallInfo">Year: ${recall.ModelYear}</p>
                <p class = "recallInfo">Make: ${recall.Make}</p>
                <p class = "recallInfo">Model: ${recall.Model}</p>
                <p class = "recallInfo">Recalled Part: ${recall.Component}</p>
                <p class = "recallInfo">Summary: ${recall.Summary}</p>
                <p class = "recallInfo">Solution: ${recall.Remedy}</p> <hr>
                </div>`;
                    $("#recallResults").append(batman);
                }
            }

        });
    }
});