Hi! I'm trying to make an ajax call from the tml page. The idea would be to invoke a servlet to return me a string. The javascript function is:
function getComment(paramId) { var xmlhttp; if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { //document.getElementById("myDiv").innerHTML=xmlhttp.responseText; alert('El server responde' + xmlhttp.responseText); } } xmlhttp.open("GET","/myapp/combo/?personId=paramId",true); xmlhttp.send(); } The url "/myapp/combo/" is mapped in web.xml: <servlet> <servlet-name>ComboServlet</servlet-name> <servlet-class>xxx.xxx.ComboServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>ComboServlet</servlet-name> <url-pattern>/combo/*</url-pattern> </servlet-mapping> The problem is that it seems that the url is wrong, because the servlet does not intercept the "GET". Does anyone know what I'm doing wrong, or if there is another way? Thanks!!!