diff options
author | 2009-02-15 10:32:50 -0500 | |
---|---|---|
committer | 2009-02-15 10:32:50 -0500 | |
commit | 1557ac806159fe58eaa442527f73e569dd04f88e (patch) | |
tree | 97a0ff4ed73faa83667f997d5fa13306ba98789b /lib/js/urweb.js | |
parent | e27335a18e8f4b1cca2749e8d41863b3cbef9b62 (diff) |
First gimpy RPC
Diffstat (limited to 'lib/js/urweb.js')
-rw-r--r-- | lib/js/urweb.js | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/lib/js/urweb.js b/lib/js/urweb.js index c46263b8..9dd4dbbe 100644 --- a/lib/js/urweb.js +++ b/lib/js/urweb.js @@ -111,3 +111,32 @@ function cr(n) { return closures[n](); } + +function getXHR() +{ + try { + return new XMLHttpRequest(); + } catch (e) { + try { + return new ActiveXObject("Msxml2.XMLHTTP"); + } catch (e) { + try { + return new ActiveXObject("Microsoft.XMLHTTP"); + } catch (e) { + throw "Your browser doesn't seem to support AJAX."; + } + } + } +} + +function rc(uri, k) { + var xhr = getXHR(); + + xhr.onreadystatechange = function() { + if (xhr.readyState == 4) + k(xhr.responseText); + }; + + xhr.open("GET", uri, true); + xhr.send(null); +} |