Reputation: 102439
I am using ajaxForm. Now I have encountered a problem. My idea is when the user enters the username, if any wrong username, it should report a message to the user.
My code is working fine, but the problem is that after the report Message shown to the user, the submit button becomes inactive. So, the user is unable to click the submit button again.
How do I tackle this problem?
$(document).ready(function(){
$('#myForm').ajaxForm(function(data) {
if (data==1){
$('#bad').fadeIn("slow");
}
});
});
...
<body>
<p id='bad' style="display:none;">Please enter a valid username</p>
</body>
...
<form id="myForm" action=" " method="post">
<center> <input type="submit" id="submitinput" value="Submit"/> </center>
</form>
...
Upvotes: 2
Views: 1325
Reputation: 93458
You might want to try catching the submit event on the form and then using ajaxSubmit. Like this:
$('#myForm').submit(function() {
$(this).ajaxSubmit(function (data) {
if (data==1){
$('#bad').fadeIn("slow");
}
});
return false;
});
It'll probably sidestep whatever funny business you're experiencing.
Upvotes: 2