If i remove the form tag from html the AJAX request is working fine, but then i have problem with my html document.
Code: Select all
<script type="text/javascript">
$(document).ready(function(){
$("button").click(function(){
$.ajax({
url:"validate_scripts/validate_login.php",
data:$("form").serialize(),
type:"post",
success:function(response,status){
alert(response+":"+status);
}
});
});
});
</script>
Code: Select all
<form id="login_frm" action="">
<table>
<caption>Insert username and password</caption>
<tr>
<td>Username</td>
<td><input type="text" name="user_name" id="user_name"/></td>
</tr>
<tr>
<td>Password</td>
<td><input type="password" name="user_pwd" id="user_pwd" /></td>
</tr>
<tr>
<td>Keep my identity <input type="checkbox" name="set_cookie" id="set_cookie" /></td>
<td id="loading"></td>
</tr>
<tr>
<td><button>Login</button></td>
</tr>
</table>
</form>
Thanks in advance..