I need to send data from html form in my yii2 app. I need to use ajax to send data from this form and get the response from server to output it. In yii 1.0 i was using very useful helper ajaxSubmitButton and i can't find how to send data from form with ajax in yii2. Could you tell me how to do it? Is there any article about it?
Thank you.
reload the form when the submit fails for a server validation rule
Yii ActiveForm supports JavaScript events in many stages of its life cycle. You can use
beforeSubmit
event for achieving what you are looking for. In JavaScript:Note that you can stop the normal submission of the form by returning
false
from the event callback.