Skip to content

Commit

Permalink
use fetch in example instead of util.ajax
Browse files Browse the repository at this point in the history
  • Loading branch information
hizzgdev committed Jan 2, 2024
1 parent cb90143 commit 5767531
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion example/2_features.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
<div>1. Open</div>
<ol type="A">
<li><button onclick="open_json();">open example</button></li>
<li><button onclick="open_ajax();">open remote</button></li>
<li><button onclick="open_remote();">open remote</button></li>
<li>
<button onclick="prompt_info('see 6.Multi Format');">
open local file
Expand Down
9 changes: 4 additions & 5 deletions example/2_features.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,10 @@ function open_json() {
_jm.show(mind);
}

function open_ajax() {
var mind_url = 'data_example.json';
jsMind.util.ajax.get(mind_url, function (mind) {
_jm.show(mind);
});
function open_remote() {
fetch('data_example.json')
.then(resp => resp.json())
.then(mind => _jm.show(mind));
}

function screen_shot() {
Expand Down
2 changes: 1 addition & 1 deletion example/2_features_cn.html
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
<div>1. Open</div>
<ol type="A">
<li><button onclick="open_json();">open example</button></li>
<li><button onclick="open_ajax();">open remote</button></li>
<li><button onclick="open_remote();">open remote</button></li>
<li>
<button onclick="prompt_info('see 6.Multi Format');">
open local file
Expand Down
2 changes: 1 addition & 1 deletion example/data_example.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
"topic": "test node",
"direction": "left",
"children": [
{ "id": "other1", "topic": "I'm from ajax" },
{ "id": "other1", "topic": "I'm from remote" },
{ "id": "other2", "topic": "I can do everything" }
]
}
Expand Down

0 comments on commit 5767531

Please sign in to comment.