| <html> |
| <head> |
| <title>Interaction Example</title> |
| |
| |
| <script language="Javascript"> |
| function doXhrPost(value) { |
| var xhr = new XMLHttpRequest(); |
| xhr.open("POST", "http://localhost:8000/interaction/test", false); |
| xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); |
| xhr.onreadystatechange = function() { |
| if (xhr.readyState != 4) { return; } |
| updatepage(xhr.responseText); |
| } |
| xhr.send(value); |
| } |
| |
| function updatepage(str){ |
| document.getElementById("content").innerHTML = str.replace(/\n/g, '<br/>'); |
| } |
| </script> |
| </head> |
| <body> |
| <input type="button" name="PASS" value="PASS" |
| onClick="doXhrPost('result=pass')"> |
| <input type="button" name="FAIL" value="FAIL" |
| onClick="doXhrPost('result=fail')"> |
| <div id="content"></div> |
| </body> |
| </html> |