diff options
Diffstat (limited to 'test/uscxml/templates')
-rw-r--r-- | test/uscxml/templates/xhtml-invoker.html | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/test/uscxml/templates/xhtml-invoker.html b/test/uscxml/templates/xhtml-invoker.html index 7773231..bacfe79 100644 --- a/test/uscxml/templates/xhtml-invoker.html +++ b/test/uscxml/templates/xhtml-invoker.html @@ -1,6 +1,8 @@ <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> + + <!-- Get domLoaded event across browsers --> <script type="text/javascript"> // see http://stackoverflow.com/questions/1206937/javascript-domready var domLoaded = function(callback) { @@ -60,8 +62,8 @@ /* Other web browsers */ window.onload = callback; }; - - </script> + </script> + <script type="text/javascript"> function CometSession(options) { @@ -110,10 +112,13 @@ self.cometPoll.send(null); }; - this.post = function(name, data) { + this.post = function(name, data, contentType) { self.xhr.open("POST", self.server + (self.query ? "?" + self.query : "")); self.xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); self.xhr.setRequestHeader('X-SCXML-Name', name); + if (contentType) { + self.xhr.setRequestHeader('Content-Type', contentType); + } self.xhr.send(data); } @@ -147,7 +152,7 @@ } else { data = thing; } - this.post(name, data); + this.post(name, data, "application/json"); } // helper function to determine whether something is a html node @@ -173,8 +178,8 @@ <script type="text/javascript"> domLoaded(function () { scxml = new CometSession({ - element: document.getElementById("${scxml.invokeId}"), - server: "${scxml.server}", + //element: document.getElementById("${scxml.invokeId}"), + server: document.URL, onRcvd : function(data) { if (data.responseXML) { var type = data.getResponseHeader("X-SCXML-Type") || "replacechildren"; |