summaryrefslogtreecommitdiffstats
path: root/test/uscxml/templates
diff options
context:
space:
mode:
authorStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2014-08-15 19:34:34 (GMT)
committerStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2014-08-15 19:34:34 (GMT)
commit940de61e5b6d8651f6ea8b1626c92f5d80cb723c (patch)
tree5496b8b5274d9333794f90acdc31b39001707be9 /test/uscxml/templates
parent9149b28c87c7a037dfd244aa5d4c1409b6593dca (diff)
downloaduscxml-940de61e5b6d8651f6ea8b1626c92f5d80cb723c.zip
uscxml-940de61e5b6d8651f6ea8b1626c92f5d80cb723c.tar.gz
uscxml-940de61e5b6d8651f6ea8b1626c92f5d80cb723c.tar.bz2
Polished xhtml invoker
Diffstat (limited to 'test/uscxml/templates')
-rw-r--r--test/uscxml/templates/xhtml-invoker.html17
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";