Skip to content
This repository has been archived by the owner on Apr 20, 2018. It is now read-only.

Fixing errors and making example work #29

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,10 @@ Now that we have the throttled input from the textbox, we need to query our serv
```js
function searchWikipedia(term) {
return $.ajaxAsObservable({
url: 'http://en.wikipedia.org/w/api.php',
url: 'https://en.wikipedia.org/w/api.php',
data: { action: 'opensearch',
search: term,
format: 'json' }
format: 'json' },
dataType: 'jsonp'
});
}
Expand All @@ -116,14 +116,15 @@ Finally, we'll subscribe to our observable by calling subscribe which will recei
var selector = $('#results');

var subscription = suggestions.subscribe(
function (data) {
selector.clear();
function (res) {
var data = res.data;
selector.empty();
$.each(data[1], function (_, text) {
$('<li>' + text + '</li>').appendTo(selector);
});
},
function (e) {
selector.clear();
selector.empty();
$('<li>Error: ' + e + '</li>').appendTo('#results');
}
);
Expand Down