diff options
author | Li Haoyi <haoyi@dropbox.com> | 2014-11-02 00:30:33 -0700 |
---|---|---|
committer | Li Haoyi <haoyi@dropbox.com> | 2014-11-02 00:30:33 -0700 |
commit | d00a2e25a9ee527fa39feb04c3137715501e9fda (patch) | |
tree | 250e6272708f3f346e2e91ef2f0b76eebfc953b3 /examples/src/main/resources/webpage/weather.js | |
parent | 00746e5c8d1d731d0a0cb581f3bddadde31d0d31 (diff) | |
download | hands-on-scala-js-d00a2e25a9ee527fa39feb04c3137715501e9fda.tar.gz hands-on-scala-js-d00a2e25a9ee527fa39feb04c3137715501e9fda.tar.bz2 hands-on-scala-js-d00a2e25a9ee527fa39feb04c3137715501e9fda.zip |
Moved things into folders, sketched out a broad skeleton of the rest of the book
Diffstat (limited to 'examples/src/main/resources/webpage/weather.js')
-rw-r--r-- | examples/src/main/resources/webpage/weather.js | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/examples/src/main/resources/webpage/weather.js b/examples/src/main/resources/webpage/weather.js new file mode 100644 index 0000000..8e95305 --- /dev/null +++ b/examples/src/main/resources/webpage/weather.js @@ -0,0 +1,17 @@ +function WeatherJs(target) { + var xhr = new XMLHttpRequest() + + xhr.open("GET", + "http://api.openweathermap.org/data/" + + "2.5/weather?q=Singapore" + ); + + xhr.onload = function (e) { + if (xhr.status == 200) { + var pre = document.createElement("pre"); + pre.textContent = xhr.responseText; + target.appendChild(pre); + } + }; + xhr.send(); +}
\ No newline at end of file |