I have a code like this.
<html>
<head>
<title>Captcha With Refresh Feature</title>
<script src="jquery.js" type="text/javascript"></script>
<script type="text/javascript">
function check1(){
var search_val=$("#security_code").val();
if(search_val == ''){
alert("Please enter code");
return false;
}else{
$.ajax({
type: "POST",
url: "find.php",
data: "search_term="+search_val,
success: function(msg){
if(msg == 'failure'){
document.myform.submit();
}else{
alert("Please enter correct code");
return false;
}
}
});
}
return false;
}
}
</script>
</head>
<body onLoad="new_captcha();">
<form action="check.php" method="post" name="myform" id="myform" onSubmit="return check1()">
<table>
<tr>
<td> </td>
<td><img border="0" id="captcha" src="image.php" alt="">
<a href="JavaScript: new_captcha();"><img border="0" alt="" src="refresh.png" align="bottom"></a></td></tr>
<tr><td>Name</td><td><input type="text" name="u_name" id="u_name" /></td></tr>
<tr>
<td>Security Code:</td>
<td><input type="text" name="security_code" id="security_code">
</td><td><input type="submit" name="submit" value="Check"></td> <td><label id="security_code_error"></label><label id="security_code_error1"></label></td></tr> </table>
</form>
</body>
</html>
My ajax response will be either success or failure. I can alert and check my ajax response. Now, i have problem with form submit.
I am getting this below error: document.myform.submit is not a function
How to force or make my form submit if the response is success. Could you help me on this.
Thanks - Haan