Local HTML and JSON-Server data. Getting the data from JSON-Server and using it in JQuery.
Resolved with help of Kevin B and Sirko. Leaving the JS (JQuery) so it can be coppied in the future.
var i = 0;
var output;
$("#send").click(function(e) {
$.getJSON("http://localhost:3000/db", function(data) {})
.done(function(json) {
$.each(json, function(key, val) {
output+= '<p>name=' + json[i].name + '</p>';
i++;
});
$("#paragraph").append(output);
})
.fail(function(jqxhr, textStatus, error) {
var err = textStatus + ", " + error;
console.log("Request Failed: " + err);
});
});
` element that you are appending Table Rows and Cells. This is not a good practice. You may need to consider how you are constructing the content.
– Twisty Feb 02 '22 at 20:59in the html just to see the data and it worked. Thank you so much again.
– Jaime Garcia Feb 02 '22 at 21:45