~ merge
authorAlexandre Bertails <bertails@w3.org>
Tue, 23 Aug 2011 17:06:17 -0400
changeset 33 dff4c2111c56
parent 32 7d4682ad247b (current diff)
parent 31 81ebc65be8b6 (diff)
child 34 706da0c41f50
~ merge
--- a/src/main/resources/scripts/tracker.js	Tue Aug 23 17:05:59 2011 -0400
+++ b/src/main/resources/scripts/tracker.js	Tue Aug 23 17:06:17 2011 -0400
@@ -54,14 +54,14 @@
   },
 
   // send information to the server as JSON
-  sendAsJSON : function (uri, data) {
+  postNewResourceAsJSON : function (uri, data) {
     var xhr = new XMLHttpRequest;
 
     try {
     xhr.open("POST", uri, true);
     xhr.onreadystatechange = function() {
         if (xhr.readyState == 4) {
-            if (xhr.status != 200) { // this needs to be 201
+            if (xhr.status != 201) {
               Util.log("xhr failed? [" + xhr.status + "] " + xhr.statusText);
             } else {
               Util.log("resource created at " + xhr.getResponseHeader("Location"));
@@ -320,7 +320,7 @@
   document.getElementById("start").textContent = "Start";
   document.getElementById("stop").disabled = true;
   Util.log("");
-  if (!Util.sendAsJSON(app.user.getPostRunURI(),app.currentActivity)) {      
+  if (!Util.postNewResourceAsJSON(app.user.getPostRunURI(),app.currentActivity)) {      
     if (!Util.store.set("track_gps_app", app.currentActivity)) {
       Util.log("[ERROR] Can't store the value " + e.code);
     }