I am developing an application using jquery along with servlets.I have been using jquery theme roller for interface In my Login.jsp
<html>
<head>
<script>
$(document).ready(function() {
$("#dialog").dialog();
});
</script>
<script>
$("#submit").click(function(){
$("#LoginForm").submit(function()
{
var username=$("#username").val();
var password=$("#password").val();
var datastring='username='+username+ '&password= '+password;
$.ajax({
type: "POST",
url:'Login',
data: datastring
error: function(){
alert("Data Error");
},
success: function (data){
window.location.replace("Items.jsp");
}
});
});
});
</script>
</head>
<body style="font-size:62.5%;">
<div id="dialog" title="Login">
<form id="LoginForm" method="post">
<fieldset>
<label>Username:</label>
<input type="text" id="username"></input><br></br>
<label>Password:</label>
<input type="password" id="pwd"></input><br></br>
<input type="submit" id="submit" value="Log In" align="middle"></input>
</fieldset>
</form>
</div>
The data is being passed to the servlet and once the login is successful i want the user to be redirect to a new page say Items.jsp. In my callback I have used window.location.replace("Items.jsp").I am not able to redirect.
I tried with response.sendRedirect("Items.jsp") and return *"Items.jsp" *
But am Not able to Redirect it to a new page.Where I am goin wrong..
Thanks:)