Hi
I am not been able to receive URL parameters passed from my ajax code in my jsp.
Here is the code
function showDetails()
{
document.detailsForm.sltdUser.value = selectedUserID;
alert('selectedUserID' + selectedUserID);
var httpRequest;
var url = 'showDetails.jsp?sltdUser = ' + selectedUserID;
if (window.XMLHttpRequest) { // Mozilla, Safari, ...
httpRequest = new XMLHttpRequest();
}
else if (window.ActiveXObject) { // IE
try {
httpRequest = new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e) {
try {
httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e) {}
}
}
if (!httpRequest) {
alert('Giving up :( Cannot create an XMLHTTP instance');
return false;
}
httpRequest.open('GET',url, true);
httpRequest.onreadystatechange = function() { processResponse(httpRequest); };
httpRequest.send(null);
}
function processResponse(httpRequest) {
if (httpRequest.readyState == 4) {
if (httpRequest.status == 200) {
alert(httpRequest.responseText);
} else {
alert('There was a problem with the request.');
}
}
}
showDetails.jsp
<%
String userId = request.getParameter("sltdUser");
%>
<script type="text/javascript">
alert('userId' + userId);
</script>
The problem is in the alert I see that userId is not taking the value passed.
Kindly help.
Thanks
Abhik