HTML markup:
<ul>
<li class="entries"></li>
</ul>
jQuery code:
$(function () {
$.ajax({
url: "http://query.yahooapis.com/v1/public/yql",
dataType: "jsonp",
success: function (data) {
console.log(data.query.results.json);
$.each(data.query.results.json.entries, function (i, v) {
$('#entries').append(data.query.results.json.entries[i].content + '<br />');
});
}, data: {
q: 'select * from json where url="https://www.facebook.com/feeds/page.php?id=397319800348866&format=json"',
format: "json"
}
});
});
I want to see the output as a menu.when click on the title it will show the content and image also. How will I do this with jQuery and html?
Create a title and content element for each entry, and toggle the visibility of the content element when you click on the title:
Javascript:
CSS:
Demo: http://jsfiddle.net/DtNxb/5/