Live example
Sub Initialize
<script>
var http_request = false;
function makePOSTRequest(url, parameters) {
http_request = false;
if (window.XMLHttpRequest) { // Mozilla
http_request = new XMLHttpRequest();
if (http_request.overrideMimeType) {
http_request.overrideMimeType('text/xml');
}
} else if (window.ActiveXObject) { // IE
try {
http_request = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
http_request = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {}
}
}
if (!http_request) {
alert('Cannot create XMLHTTP instance');
return false;
}
http_request.onreadystatechange = GetResponse;
http_request.open('POST', url, true);
http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
http_request.setRequestHeader("Content-length", parameters.length);
http_request.setRequestHeader("Connection", "close");
http_request.send(parameters);
}
function GetResponse() {
if (http_request.readyState == 4) {
if (http_request.status == 200) {
result = http_request.responseText;
document.getElementById('test').innerHTML = result;
} else {
alert('There was a problem with the request.');
}
}
}
function GetAgentData(txtdata) {
var poststr = txtdata; //encodeURI(txtdata);
makePOSTRequest('/test.nsf/postagent?openagent', poststr);
}
</script>
<br>
<div id="test">This text will be replaced</div>
<br><br>
<a href="javascript:GetAgentData(document.getElementById('test').innerHTML);">Run agent, run!</a>
<br>
-------------- LOTUSSCRIPT AGENT ---------------------
Sub Initialize
Dim session As New NotesSession
Dim doc As NotesDocument
Set doc=session.DocumentContext
req=doc.Request_Content(0)
For x=Len(req) To 1 Step -1
tmp=tmp+Mid(req,x,1)
Next
Print tmp
End Sub