Commit 8d84dc8a7614749c5312bb3b2b7f6e60ed540e3a
1 parent
02d2f40a
Exists in
master
Communicate with translate api
Showing
2 changed files
with
12 additions
and
1 deletions
Show diff stats
app/main.js
| ... | ... | @@ -11,4 +11,14 @@ document.addEventListener("DOMContentLoaded", function(event) { |
| 11 | 11 | chrome.runtime.onMessage.addListener( |
| 12 | 12 | function(request, sender, sendResponse) { |
| 13 | 13 | console.log(request.selectedText); |
| 14 | + | |
| 15 | + req = new XMLHttpRequest(); | |
| 16 | + req.open('GET', 'http://localhost:8000/translate.json', true); | |
| 17 | + req.onreadystatechange = function () { | |
| 18 | + if (req.readyState == 4) { | |
| 19 | + console.log(JSON.parse(req.responseText)); | |
| 20 | + } | |
| 21 | + }; | |
| 22 | + | |
| 23 | + req.send(); | |
| 14 | 24 | }); | ... | ... |