$(document).ready(function () { 'use strict'; $('#letter-a a').click(function (event) { event.preventDefault(); $('#dictionary').load('a.html'); }); $('#letter-b a').click(function (event) { event.preventDefault(); $.getJSON('b.json', function (data) { var html = ''; $.each(data, function (entryIndex, entry) { html += '
'; html += '

' + entry.term + '

'; html += '
' + entry.part + '
'; html += '
'; html += entry.definition; if (entry.quote) { html += '
'; $.each(entry.quote, function (lineIndex, line) { html += '
' + line + '
'; }); if (entry.author) { html += '
' + entry.author + '
'; } html += '
'; } html += '
'; html += '
'; }); $('#dictionary').html(html); }); }); $('#letter-c a').click(function (event) { event.preventDefault(); $.getScript('c.js'); }); $('#letter-d a').click(function (event) { event.preventDefault(); $.get('d.xml', function (data) { console.log(data); }); }); });