I have some doubts and problems.
My code is as follows.
in html
<div id="summary"></div>
in js
function callurl() {
$.ajax({
url: 'https://jsonplaceholder.typicode.com/posts',
type: "GET",
dataType: "json",
success: function(msg) {
JsonpCallback(msg);
},
error: function() {
ErrorFunction();
}
});
}
function JsonpCallback(json) {
for (var i = 0; i < json.length; i++) {
$('#summary').append('<b>Post:</b> ' + json[i].id + '<br />');
$('#summary').append('<b>Título:</b> ' + json[i].title + '<br />');
$('#summary').append('<b>Descripción:</b> ' + json[i].body + '<br />');
$('#summary').append('<hr />');
}
}
callurl();
I need, the way to create a list.
Example.
Post: 1
Title: sunt aut facere repellat provident occaecati excepturi optio reprehenderit
Boton Abrir contenido.
Clicking opens the content of that post.
Content: uia et suscipit suscipit recusandae expedquuntur expedita et cum reprehenderit molestiae ut ut quas totam nostrum rerum est autem sunt rem eveniet architecto.
I want to get to a small app, where a post feed with the title is shown and when I click on it, open the content of that post.