Ajax form submitting twice with Yii 2 Ajax form submitting twice with Yii 2 ajax ajax

Ajax form submitting twice with Yii 2


You may need to change your code like below:

$('#company_form').submit(function(e) {    e.preventDefault();    e.stopImmediatePropagation();    signup('company');    return false;}); 

http://api.jquery.com/event.stoppropagation/

http://api.jquery.com/event.stopimmediatepropagation/


Solution common

Next JS will works with any state of 'enableClientValidation':

$('#company_form').on('beforeSubmit', function (e) {    signup('company');    return false;}); 

https://yii2-cookbook.readthedocs.io/forms-activeform-js/#using-events