##// END OF EJS Templates
hgweb: add makeRequest javascript function...
Alexander Plavin -
r19740:2228bd10 default
parent child Browse files
Show More
@@ -304,3 +304,27 b' function format(str, replacements) {'
304 return String(replacements[p1]);
304 return String(replacements[p1]);
305 });
305 });
306 }
306 }
307
308 function makeRequest(url, method, onstart, onsuccess, onerror, oncomplete) {
309 xfr = new XMLHttpRequest();
310 xfr.onreadystatechange = function() {
311 if (xfr.readyState === 4) {
312 try {
313 if (xfr.status === 200) {
314 onsuccess(xfr.responseText);
315 } else {
316 throw 'server error';
317 }
318 } catch (e) {
319 onerror(e);
320 } finally {
321 oncomplete();
322 }
323 }
324 };
325
326 xfr.open(method, url);
327 xfr.send();
328 onstart();
329 return xfr;
330 }
General Comments 0
You need to be logged in to leave comments. Login now