I'm trying to create a list (not a
These are my results showing in the console.log:
{trails: Array(10), success: 1} success: 1 trails: Array(10) 0: {id: 7003421, name: "Mount Helena Ridge Trail", type: "Trail", summary: "Follows the Mount Helena ridgeline from Prosepector Gulch to the Mount Helena City Park trails.", difficulty: "greenBlue", …} 1: {id: 7004967, name: "Emmett's Trail", type: "Trail", summary: "A nice forested and shaded option for climbing up to the Mt. Helena Ridge Trail from Grizzly Gulch.", difficulty: "blueBlack", …} 2: {id: 7004981, name: "Mt Ascension Loop", type: "Trail", summary: "A partial loop trail that follows the north side of Mt Ascension and loops around to the south side.", difficulty: "blue", …} 3: {id: 7004847, name: "Stairway to Heaven", type: "Trail", summary: "A short trail climbing at first, then dropping through short switchbacks to connect to Wakina Gulch.", difficulty: "blue", …} 4: {id: 7004852, name: "Wakina Sky Trail", type: "Trail", summary: "A trail that climbs through forest and then into a meadow and forms a beautiful 2+ mile loop.", difficulty: "blue", …} 5: {id: 7004842, name: "Entertainment Trail", type: "Trail", summary: "A beautiful trail climbing Mt. Ascension with great views of the surrounding mountains.", difficulty: "blueBlack", …} 6: {id: 7005245, name: "Archery Range Trail", type: "Trail", summary: "A flat trail that hugs the contours of Mt. Ascension.", difficulty: "greenBlue", …} 7: {id: 7004841, name: "Eagle Scout Trail", type: "Trail", summary: "A short ascent taking you to the Mt Ascension trail system.", difficulty: "blueBlack", …} 8: {id: 7005001, name: "Rodney Meadow Trail", type: "Trail", summary: "A short climb and then a nice flat trail through a meadow with views.", difficulty: "blue", …} 9: {id: 7004980, name: "2006 Trail", type: "Trail", summary: "A climbing switchback trail up the north side of Mt Ascension.", difficulty: "blue", …} length: 10
url: hikeQueryURL,
method: "GET"
}).then(function(hikeResponse) {
// Printing the entire object to console
console.log(hikeResponse);
for(i = 0; i < trails.length; i++) {
// Constructing HTML containing the trail information
var hikeName = $("<h1>").text(hikeResponse.trails.name);
var hikeImage = $("<img>").attr("src", hikeResponse.trails.imgSqSmall);
var hikeSummary = $("<p>").text(hikeResponse.trails.summary);
var hikeLength = $("<h2>").text("Trail length: " + hikeResponse.trails.length);
var hikeCondition = $("<p>").text("Current Trail Conditions: " + hikeResponse.trails.conditionStatus + ": " + hikeResponse.trails.conditionDetails);
// Empty the contents of the "hiking-info" div, append the new trail content
$("#hiking-info").empty();
$("#hiking-info").append(hikeName, hikeImage, hikeSummary, hikeLength, hikeCondition);
};
});```
I'm just expecting all of the info from the AJAX return to be put into my variables, then appended into my empty "hiking-info" div.