my HTML code is
<form id="formoid" action="" title="" method="post" onSubmit="return myfunction(event)">
<div>
<label class="title">First Name</label>
<input type="text" id="name" name="name" >
</div>
<div>
<label class="title">Name</label>
<input type="text" id="name2" name="name2" >
</div>
<div>
<input type="submit" id="submit" name="submit" value="Submit">
</div>
</form>
MY JS code is :
<script src="https://code.jquery.com/jquery-1.9.1.js"></script>
<script language="JavaScript">
function myfunction(event) {
event.preventDefault();
/// Here I am sending a post..
//// how do I keep submitting?
}
</script>
I made a function that stops the submission normally and I want to continue the submission after that. I need to stop the normal submission because I am sending a post using Ajax.
I tried many solutions like :
I could do
$(form).submit(function(e) {
e.preventDefault();
var self = this;
// Code...
if (true) {
self.submit();
} else {
// Code...
}
});
but I can't do it with the form name because I want to return the function onSubmit
is there a way to keep submitting without the need of $(form).submit(function(e) code line?
is there something that i can put in the function?