Changed signature of postAsJSON to handle auth
authorplehegar
Fri, 26 Aug 2011 11:42:27 -0400
changeset 109 70322101593e
parent 108 09bfee98db20
child 110 8ec4ad627381
Changed signature of postAsJSON to handle auth
src/main/resources/scripts/Utils.js
--- a/src/main/resources/scripts/Utils.js	Fri Aug 26 11:39:26 2011 -0400
+++ b/src/main/resources/scripts/Utils.js	Fri Aug 26 11:42:27 2011 -0400
@@ -159,9 +159,11 @@
   },
 
  // send information to the server as JSON
-  postAsJSON : function (uri, data, successHandler, errorHandler) {
+  postAsJSON : function (uri, resource, successHandler, errorHandler) {
   	try {
-    	Util.post(uri, { contentType : "application/json", data : JSON.stringify(data) }, successHandler, errorHandler);
+  		resource.contentType = "application/json";
+  		resource.data = JSON.stringify(resource.data);
+    	Util.post(uri, resource, successHandler, errorHandler);
    	} catch (e) {
    		errorHandler(e);
    	}