I would like to display a request from my JSON placeholder. I'm unsure where to start or even what is the right question to ask to resolve my error.
I understand why the error occurs as shown here (what does [object Object] mean?) I don't understand how to fix the problem. I know I would need to use console.log() but unsure how to return the specific values to a variable then display it on the screen.
HTML
<button type="button" class="btn btn-dark">Click here to execute your first Ajax get request</button>
Javascript
$(document).ready(function(){
$("button").click(function(){
$.get("https://jsonplaceholder.typicode.com/todos/1", function(title, completed){
alert("Title: " + title + "\nCompleted: " + completed);
});
});
});
Expected result
"Title": "delectus aut autem",
"completed": success