Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 3291813

Browse filesBrowse files
NataliaTepluhinayyx990803
authored andcommitted
fix: fixed Wikipedia example to use RxJS ajax (#102)
1 parent dcd0ab8 commit 3291813
Copy full SHA for 3291813

File tree

Expand file treeCollapse file tree

1 file changed

+5
-10
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+5
-10
lines changed

‎example/wiki-search.html

Copy file name to clipboardExpand all lines: example/wiki-search.html
+5-10Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
<script src="https://unpkg.com/jquery"></script>
21
<script src="https://unpkg.com/rxjs/bundles/rxjs.umd.js"></script>
32
<script src="https://unpkg.com/vue/dist/vue.js"></script>
43
<script src="../dist/vue-rx.js"></script>
@@ -23,18 +22,14 @@ <h1>{{ results.term }}</h1>
2322

2423
<script>
2524
const { from } = rxjs
25+
const { ajax } = rxjs.ajax
2626
const { pluck, filter, debounceTime, distinctUntilChanged, switchMap, map } = rxjs.operators
2727

28+
const baseUrl =
29+
'https://en.wikipedia.org/w/api.php?action=opensearch&format=json&origin=*'
30+
2831
function fetchTerm (term) {
29-
return from($.ajax({
30-
url: 'http://en.wikipedia.org/w/api.php',
31-
dataType: 'jsonp',
32-
data: {
33-
action: 'opensearch',
34-
format: 'json',
35-
search: term
36-
}
37-
}).promise())
32+
return ajax.getJSON(`${baseUrl}&search=${term}`)
3833
}
3934

4035
function formatResult (res) {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.