Richard
Richard

Reputation: 4546

ajax call fails to return true or false to the submit event

I will just come right to it.

I need to know how I can return false or true to a submitbutton. I read some other post here, that says it cannot be done from within a ajax success function because it will return to the ajax context and not the submit event.

Maybe someone has a workaround for this?? also in the context that I am loading a form from another page.

Some background:

I load a form from another page and in the callback, I write the submit function because otherwise I don't have a way to connect to the submit button. In the submit function I check the input for some fields. If everything checks out, it proceeds with the ajax call to a php script.

Upvotes: 1

Views: 756

Answers (2)

The OP wrote:

Solved it by using someone else's suggestion to put the ajax call in a click event and when necessary, use $('form').submit();

Upvotes: 0

Darin Dimitrov
Darin Dimitrov

Reputation: 1039140

In the success callback of the AJAX request which refreshes the form you could reattach the submit event handler to it.

Upvotes: 2

Related Questions