{"size": 881, "ext": "js", "max_stars_repo_path": "common/components/assets/activeForm.js", "max_stars_repo_name": "myafk/yii2-shop", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "common/components/assets/activeForm.js", "max_issues_repo_name": "myafk/yii2-shop", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "common/components/assets/activeForm.js", "max_forks_repo_name": "myafk/yii2-shop", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 32.6296296296, "max_line_length": 143, "alphanum_fraction": 0.6447219069}
$.fn.activeFormAjaxSubmit = function () {

	this.on('beforeSubmit', function () {
		var form = $(this);
		var button = form.find('input[type="submit"], button[type="submit"]').prop('disabled', true);
		var data = form.data('additionalParams') ? mergeParams(form.serializeAndEncode(), form.data('additionalParams')) : form.serializeAndEncode();
		var jsonResponseOpts = form.data('jsonResponseOpts') ? form.data('jsonResponseOpts') : {};
		$.ajax({
			url: form.attr('action'),
			type: form.attr('method'),
			data: data,
			success: function (json) {
				if (json.hasOwnProperty('errors'))
					form.yiiActiveForm('updateMessages', json.errors);
				else
					processJsonResponse(json, $.extend(true, {
						form: form,
					}, jsonResponseOpts));
			},
			complete: function () {
				button.prop('disabled', false);
				$.preloader().destroy();
			}
		});
		return false;
	});
}