| 1 |
<html> |
|---|
| 2 |
<head> |
|---|
| 3 |
<script language="javascript"> |
|---|
| 4 |
|
|---|
| 5 |
function xmlhttpPost(url, strSubmit ) { |
|---|
| 6 |
var xmlHttpReq = false; |
|---|
| 7 |
|
|---|
| 8 |
if (window.XMLHttpRequest) { |
|---|
| 9 |
xmlHttpReq = new XMLHttpRequest(); |
|---|
| 10 |
xmlHttpReq.overrideMimeType('text/xml'); |
|---|
| 11 |
} |
|---|
| 12 |
|
|---|
| 13 |
else if (window.ActiveXObject) { |
|---|
| 14 |
xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP"); |
|---|
| 15 |
} |
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
xmlHttpReq.open('POST', url, true); |
|---|
| 19 |
xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); |
|---|
| 20 |
xmlHttpReq.onreadystatechange = function() { |
|---|
| 21 |
if( xmlHttpReq.readyState == 4 && xmlHttpReq.responseText != "" ) { |
|---|
| 22 |
|
|---|
| 23 |
document.forms[0].log_result.value = document.forms[0].result.value + document.forms[0].log_result.value; |
|---|
| 24 |
document.forms[0].result.value = xmlHttpReq.responseText; |
|---|
| 25 |
} |
|---|
| 26 |
} |
|---|
| 27 |
var useless = strSubmit; |
|---|
| 28 |
xmlHttpReq.send(strSubmit); |
|---|
| 29 |
} |
|---|
| 30 |
|
|---|
| 31 |
var qs = "key_id=30575CA6" |
|---|
| 32 |
+ "&recipients=Jason+pratt+%3Cjas%40juniorplenty.com%3E%2C+Nicholas+D%27Angelo+%28nicksfriends%29+%3Cnick%40nicksfriends.com%3E&" |
|---|
| 33 |
+ "plaintext=" + escape( "foo bar baz" ); |
|---|
| 34 |
|
|---|
| 35 |
</script> |
|---|
| 36 |
|
|---|
| 37 |
<body> |
|---|
| 38 |
|
|---|
| 39 |
<h1>ajax form post tester |
|---|
| 40 |
|
|---|
| 41 |
<form> |
|---|
| 42 |
<input name="post_to" value="http://localhost:6667/dumb.jm3" size="50"> |
|---|
| 43 |
<input type="button" value="dumb XML" onclick="document.forms[0].post_to.value = 'http://localhost:6667/dumb.jm3' "> |
|---|
| 44 |
<input type="button" value="get secret keys" onclick="document.forms[0].post_to.value = 'http://localhost:6667/get-secret-keys.jm3' "><br> |
|---|
| 45 |
<input name="onclick_code" value="xmlhttpPost(document.forms[0].post_to.value, qs );" size="50"><br> |
|---|
| 46 |
<input type="button" value="go" onclick="eval( document.forms[0].onclick_code.value );"><br> |
|---|
| 47 |
<textarea name="result" rows="8" cols="50"></textarea><br> |
|---|
| 48 |
<textarea name="log_result" rows="8" cols="50"></textarea> |
|---|
| 49 |
</form> |
|---|
| 50 |
</body> |
|---|
| 51 |
</html> |
|---|