0

In the code below, I am using QueryString to check the variable status.
If it is 'success' then it should display "deletion successful".

I am passing url = http://localhost:9999/EmModule/EmpForm.jsp?status=success

But, it is not displaying any alert.

Note: I am using JSP page, and am rookie in it.

Thank You

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>


<script type="text/javascript">
function scheck()
{	
	var s=Request.QueryString("status"); 
	alert(s);
	if(s=="success")
	{
		alert('Deletion Successful');
	}
	
}

</script>
</head>
<body onload='scheck()' >
	<h1> Insert Employee Data </h1>
	<form action="Employee" method="POST" onsubmit="return validate_form(this)">
	<table border="1">
		<tr>
			<td>Name</td>
			<td><input type="text" name="EName"/></td>
		</tr>
		<tr>
			<td>Department</td>
			<td><input type="text" name="Dept"/></td>
		</tr>
		<tr>
			<td>Address</td>
			<td><textarea rows="2" cols="20" name="Add"></textarea></td>
		</tr>
		<tr>
			<td>
				<input type="submit"/>
			</td>
		</tr>
				
	</table>
</form>
</body>
</html>
2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by hielo
0

Request.QueryString

Wrong. That is ASP (Server-Side) code. It does not exist in javascript. You need to look at location.search (which contains the querystring) and extract if from there OR you can use the code given at:
http://www.eggheadcafe.com/articles/20020107.asp

If you use that, then instead of:

var s=Request.QueryString("status");

you would need:

var s=queryString("status");
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.