Added Accept header in HTTP POST request
authorplehegar
Tue, 23 Aug 2011 18:01:35 -0400
changeset 40 07f56d33b6f5
parent 34 706da0c41f50
child 41 042b2de8699e
Added Accept header in HTTP POST request
src/main/resources/scripts/tracker.js
--- a/src/main/resources/scripts/tracker.js	Tue Aug 23 17:07:07 2011 -0400
+++ b/src/main/resources/scripts/tracker.js	Tue Aug 23 18:01:35 2011 -0400
@@ -35,8 +35,16 @@
   },
 
   log : function (msg) {
-    var element = document.getElementById("log");
-    if (element != null) element.textContent = msg;
+    try {
+      
+      console.log(msg);
+    } catch (e) {
+      var element = document.getElementById("log");
+      if (element != null) {
+        if (element.textContent != null) element.textContent = msg;
+        if (element.innerHTML != null) element.innerHTML = msg;
+      }
+    }
   },
 
   // pretty formatting of numbers
@@ -72,6 +80,7 @@
     };
     xhr.setRequestHeader("Content-Type", "application/json");
     xhr.setRequestHeader("Content-Length", data.length);
+    xhr.setRequestHeader("Accept", "text/plain");
 
     xhr.send(JSON.stringify(data));