+/* xhr shorthand helpers */
+
+function xhrPost(url, params, complete) {
+ console.log("xhrPost:", params);
+ new Ajax.Request(url, {
+ parameters: params,
+ onComplete: complete
+ });
+}
+
+function xhrJson(url, params, complete) {
+ xhrPost(url, params, (reply) => {
+ try {
+ const obj = JSON.parse(reply.responseText);
+ complete(obj);
+ } catch (e) {
+ console.error("xhrJson", e, reply);
+ complete(null);
+ }
+
+ })
+}
+