I have problem with sending ajax request
Hello,
I wrote a login form where on submit the user is supposed to logged in, but it is not working. please let me know where is the error is,
This is the form
<form id ="loginform_" action="">
<a href=""id="slidedownclose">X</a>
<h2> Login Form</h2>
Username:<input type="text" id="uname" name="user_name" /><br/><br/>
Password:<input type="password" id="password" name="password" /><br/><br/>
<input type ="submit" id ="log" class="logclass" value="log in"/><br/><br/>
<a id ="lost_password" href ="/frontend_dev.php/forgotpassword">Forgot Password </a>
</form>
this is the jquery code
$(document).ready(function()
{
$("#loginform_").validate({
rules: {
user_name: "required",
password: "required"
}
});
$(".logclass").click(function()
{
var data =$("#loginform_").serialize();
$.ajax({
type: "POST",
url: "/frontend_dev.php/login/new",
data: data,
success: function(){
alert('success');
window.location.replace("/frontend_dev.php/user");
},
error: function(){
alert(data);
}
});
});
});
Thanks in advance.