I cannot get the form to submit inside the ajax success function:
$('#formId').on('submit', function (e) {
e.preventDefault();
});
$('#submit').on('click', this.doStuff);
doStuff: function () {
$.get('url').done(function (data) {
if (data.IsSuccessful) {
$('#formId').off('submit');
$('#formId').submit();
}
else {
}
});
}
It is unlikely that this will be done the second time this event is fired, but not the first, and it will be sent independently with these two lines of code, but not inside get (the debugger really hit it). How can I submit a form based on a successful ajax call?
Grace source
share