how can I submit a httprequest in javascript

I would like to submit the url like that : "ReportController?action=logout" in javascript, how can I do that? Because I have implemented a logout menthod for windows onbeforeunload event, which means when user close brower, the logout action will be automatically triggered and submitted to server. I use the below method, but it seems doesn't work.

function logout() {

document.mainform.method="post";

document.mainform.action="ReportController?action=logout";

document.mainform.target="_self";

document.mainform.submit();

}

Message was edited by:

henry_22

Message was edited by:

henry_22

[659 byte] By [henry_22a] at [2007-11-27 6:39:49]
# 1
Just do a redirect to that page?Looking to your post history: http://forum.java.sun.com/thread.jspa?threadID=5179905Rather cleanup old sessions on login, not on logout. This saves a heap of those nasty stuff where you certainly cannot have the full control over.
BalusCa at 2007-7-12 18:09:03 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...