--- a/src/main/resources/scripts/Utils.js Wed Aug 24 15:46:07 2011 -0400
+++ b/src/main/resources/scripts/Utils.js Wed Aug 24 17:10:36 2011 -0400
@@ -134,5 +134,25 @@
}
return result;
}
+ },
+
+ request : function (uri, body, callback, async) {
+ body = body ? body : null;
+ callback = callback ? callback : null;
+ //async = typeof(async) != 'undefined' ? async : false;
+ async = !!async;
+ var http = new XMLHttpRequest();
+ http.open('GET', uri, async);
+ http.onreadystatechange = function () {
+ console.log("state: " + http.readyState);
+ if(http.readyState == 4 && http.status == 200){
+ if (callback != null)
+ callback(http.responseText);
+ }
+ };
+ http.send(body);
+ if (async == false)
+ return http.responseText;
}
+
};