im having a few problems with an ajax login form when i am clicking submit button its not validating the form before submitting the ajax its just submitting the form where am i going wrong
this is the ajax script
function wa_login() {
var wa_username = $('#wa_username').val();
var wa_password = $('#wa_password').val();
var datas = 'wa_username=' + wa_username + '&wa_password=' + wa_password;
$.ajax({
type: 'POST',
url: '/limitless/functions.php',
data: datas
})
.done(function (data) {
$('#info').html(data);
});
}
here is the form itself
<form class='form-horizontal form-validate-jquery' action='#' novalidate='novalidate'>
<div class='text-center'>
<div class='icon-object border-slate-300 text-slate-300'><i class='icon-reading'></i></div>
<h5 class='content-group'>Login to your account <small class='display-block'>Enter your credentials below</small></h5>
</div>
<div class='form-group has-feedback has-feedback-left'>
<input type='text' class='form-control' placeholder='Username' id='wa_username' required='required'>
<div class='form-control-feedback'>
<i class='icon-user text-muted'></i>
</div>
</div>
<div class='form-group has-feedback has-feedback-left'>
<input type='password' class='form-control' placeholder='Password' id='wa_password' required='required'>
<div class='form-control-feedback'>
<i class='icon-lock2 text-muted'></i>
</div>
</div>
<div class='form-group'>
<button type='submit' onclick='wa_login()' class='btn btn-primary btn-block'>Sign in <i class='icon-circle-right2 position-right'></i></button>
</div>
<div class='text-center'>
<a href='reset'>Forgot password?</a> | <a href='register' >Sign Up</a>
</div>
</form>