diff --git a/app.js b/app.js
index 24f80a1..facbe01 100644
--- a/app.js
+++ b/app.js
@@ -1,7 +1,8 @@
-var apiKey = 'insert you key here'
-var baseUrl = 'https://api.pearson.com/longman/dictionary/0.1';
-var dataFmt = '.json';
-var searchUrl = baseUrl + '/entry' + dataFmt;
+var apiKey = 'insert you key here';
+var keyData = '';// 'apiKey=' + apiKey;
+var baseUrl = 'https://api.pearson.com/v2/dictionaries/ldoce5';
+var dataFmt = '';
+var searchUrl = baseUrl + '/entries' + dataFmt;
var debugLog;
function init(){
@@ -15,7 +16,8 @@ function init(){
function doSearch(searchFor){
debugLog.append('Looking up ' + searchFor + ' using ' + searchUrl + '
');
- var data = 'apikey=' + apiKey + '&q=' + searchFor
+ // Use double quotation marks to handle words e.g. yes-man
+ var data = keyData + '&headword=' + '"' + searchFor + '"';
$.ajax({
type: 'GET',
url: searchUrl,
@@ -34,7 +36,7 @@ function doSearch(searchFor){
function handleResponse(data){
debugLog.append('Response received
');
- var results = data.Entries.Entry;
+ var results = data.results;
var html = entry(results);
$('#resultList').html(html);
$('li>a').click(function(){
@@ -53,18 +55,18 @@ function entry(from){
html += entry(from[idx]);
}
} else {
- debugLog.append("Processing Entry: " + from.Head.HWD['#text'] + '
');
+ debugLog.append("Processing Entry: " + from.headword + '
');
html += '