This is what I got:
<form method="post" id="myform" class="myform">
<input type="submit" onclick="return claim();" name="submit" class="onsubmit" value="" />
</form>
function claim() {
var c = confirm('You sure?');
if (!c) {
return false;
}
var password = prompt("Please mention pw","");
if (password != null && password != "") {
$.post(
"/claim/",
{ partner_pwd: password },
function(data) {
if (data == '1') {
$('form').submit(function() {
alert('Handler for .submit() called.');
});
}
});
}
return false;
}
This works well, but my problem is that it won't submit the form. I tried both $('form').submit()
and $('#myform').submit()
inside the data == '1'
statement. I tried alert(1)
inside this if statement, and it displayed fine, I only need to make it submit the form, why wont this work?
Update:
Console says:
Uncaught TypeError: Property 'submit' of object #<HTMLFormElement> is not a function jquery.min.js:3 f.event.trigger