HI, this is my first post.
I am working on the book "Learning jQuery, third ed". I followed the example retrieving a json file and display it on the webpage, but it didn't work.
I even copied the example code and it didn't work either, anyone can help?
The code is very simple:
Code:$(document).ready(function() { $('#letter-a a').click(function() { $('#dictionary').load('a.html'); return false; }); $('#letter-b a').click(function() { $.getJSON('b.json', function(data) { var html = ''; $.each(data, function(entryIndex, entry) { html += '<div class="entry">'; html += '<h3 class="term">' + entry.term + '</h3>'; html += '<div class="part">' + entry.part + '</div>'; html += '<div class="definition">'; html += entry.definition; html += '</div>'; html += '</div>'; }); $('#dictionary').html(html); }); return false; }); });




Reply With Quote

Bookmarks