Below is my code so far. Problem is i cant my quotes to display. Please help
$(document).ready(function() {
$("#getQuote").click(function(event) {
event.preventDefault();
$.getJSON(
"https://codepen.io/Alkombol/pen/qYRqEo.js",function(data) {
var html = '';
$.each(data, function(entryIndex, entry) {
html += '<div class="quote">' + entry.quote + '</div>';
html += '<div class="author">' + entry.author + '</div>';
});
$('.quote-view').html(html);
});
});
});
Please use code tags or post a link. Now it looks like you’re trying to read from a different pen, which surely doesn’t return a json object.
Try using something else for storing your JSON data.
Heres a suggestion: http://myjson.com
1 Like
Solved. Had to do with caching, so i set the cache option to false . Thanks for your responses.
I’ve edited your post for readability. When you enter a code block into the forum, precede it with a line of three backticks and follow it with a line of three backticks to make easier to read. See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>
) will also add backticks around text.
1 Like