comparison lib/js/urweb.js @ 609:56aaa1941dad

First gimpy RPC
author Adam Chlipala <adamc@hcoop.net>
date Sun, 15 Feb 2009 10:32:50 -0500
parents 5145181b02fa
children d80256efc160
comparison
equal deleted inserted replaced
608:330a7de47914 609:56aaa1941dad
109 109
110 function cr(n) { 110 function cr(n) {
111 return closures[n](); 111 return closures[n]();
112 } 112 }
113 113
114
115 function getXHR()
116 {
117 try {
118 return new XMLHttpRequest();
119 } catch (e) {
120 try {
121 return new ActiveXObject("Msxml2.XMLHTTP");
122 } catch (e) {
123 try {
124 return new ActiveXObject("Microsoft.XMLHTTP");
125 } catch (e) {
126 throw "Your browser doesn't seem to support AJAX.";
127 }
128 }
129 }
130 }
131
132 function rc(uri, k) {
133 var xhr = getXHR();
134
135 xhr.onreadystatechange = function() {
136 if (xhr.readyState == 4)
137 k(xhr.responseText);
138 };
139
140 xhr.open("GET", uri, true);
141 xhr.send(null);
142 }