I looked at your code and decided to create a simple little example using Ajax.
<html xmlns="
http://www.w3.org/1999/xhtml" >
<head>
<title>Untitled Page</title>
<script language="JavaScript" src="/lib/factory.js"></script>
<script language="JavaScript" src="/lib/asynchronous.js"></script>
<script language="JavaScript" type="text/javascript">
var asynchronous = new Asynchronous();
asynchronous.complete = function( status, statusText, responseText, responseXML) {
if( status == 200) {
location.href = responseText;
}
else {
window.alert( "Error (" + statusText + "

"

;
}
}
function DoPost( link) {
var buffer = "clickedLink=" + link.href;
asynchronous.post( "/ajaxjavascript/postprocessor", "application/x-www-form-urlencoded", buffer, buffer.length);
return false;
}
</script>
</head>
<body>
<a href="/link/to/send/to/server" onclick="return DoPost( this)">Some link</a>
<a href="/another/link/to/send/to/server" onclick="return DoPost( this)">Another link</a>
</body>
</html>
In the example what happens is that Ajax is used to POST the data to the server, and in the response you navigate the page that the server returns.
The sequence of events are as follows:
1) User clicks on link
2) onclick event of link is activated calling the function DoPost passing the link element as parameter.
3) Function DoPost creates an HTTP POST request using form encoding by creating the form variable clickedLink. The value of clickedLink is the link.href property.
4) Data is sent to the server using an HTTP POST to the
servlet URL /ajaxjavascript/postprocessor that is encapsulated by the Asynchronous class defined by the file /lib/asynchronous.js located at the URL
http://www.devspace.com:8080/lib/asynchronous.js as well as
http://www.devspace.com:8080/lib/factory.js for the XMLHttpRequest factory.
5) The server receives the HTTP POST and extracts clickedLink that contains the href information of the received request.
6) Server processes the data and generates data that consists of a single line representing the URL that the browser will navigate to.
7) Client receives the HTTP POSTED data from the server in the asynchronous.complete method and verifies that the POST was successful. If successful reads the received link and assigns to location.href causing the browser to navigate to the next HTML page.
This process is a little bit more than you want, but it gives you the flexibility on how and what your want to process, ok? Or did I miss the mark?
Christian