Help with HTML hyperlink please

Posted by liz on Stack Overflow See other posts from Stack Overflow or by liz
Published on 2010-03-12T04:40:42Z Indexed on 2010/03/12 4:47 UTC
Read the original article Hit count: 250

Filed under:
|
|

Hello,

Can someone help me with this problem: I have a table in a jsp page, with the text in one column being hyperlinks. Whenever anyone of these hyperlinks is clicked the whole table should refresh and repopulate based on the value of the hyperlink clicked. My problem is currently when the hyperlink is clicked the page refreshes with an empty table. I have the following line of HTML code for performing this in my jsp page:

<TD><A href="http://localhost:8080/pmweb/gui.jsp" onclick="getResults(param)">hyperlinktext</A></TD>;

Below is my getResults function in javascript in the same JSP page:

<script type="text/javascript">
var httpRequest; 

function getResults(param) {

    var url = "http://localhost:8080/pmweb/api/GetResultsByParam?param=" + param;

    httpRequest = new XMLHttpRequest();  

    httpRequest.open("GET", url, true);

    httpRequest.onreadystatechange = function() {processRequest(); } ;

    httpRequest.send(null);   
}

I have verified that the getResults function above is working fine itself. When I debugged it I noticed that this getResults function is not entered when the hyperlink is clicked. Anyone know how to get the hyperlink calling the javascript function properly? Thanks very much in advance!

© Stack Overflow or respective owner

Related posts about html

Related posts about jsp