开发者

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 c开发者_如何学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.


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


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();

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜