Subscribe Submission Modal - Hide Full Modal After Form Submit

1 reply · opened Nov 29, 2016

BBobbyJNov 29, 2016

How do I hide the Subscribe Modal after the form has been submitted? When I hit submit, email is sent through subscribe.php, but the modal remains on the screen. I would like it to automatically close after the form has been submitted on a particular website.

SSemicolon WebSTAFFNov 30, 2016

Hello,

This is Definitely Possible. Please find the following code in the js/functions.js File inside the subscription: function() Function Block:

success: function( data ) {
	if( elementLoader == 'button' ) {
		defButton.html( defButtonText );
	} else {
		$(form).find('.input-group-addon').find('.icon-line-loader').removeClass('icon-line-loader icon-spin').addClass('icon-email2');
	}
	if( data.alert != 'error' && elementRedirect ){
		window.location.replace( elementRedirect );
		return true;
	}
	if( elementAlert == 'inline' ) {
		if( data.alert == 'error' ) {
			var alertType = 'alert-danger';
		} else {
			var alertType = 'alert-success';
		}

		elementResult.addClass( 'alert ' + alertType ).html( data.message ).slideDown( 400 );
	} else {
		elementResult.attr( 'data-notify-type', data.alert ).attr( 'data-notify-msg', data.message ).html('');
		SEMICOLON.widget.notifications( elementResult );
	}
}

and replace it with:

success: function( data ) {
	if( elementLoader == 'button' ) {
		defButton.html( defButtonText );
	} else {
		$(form).find('.input-group-addon').find('.icon-line-loader').removeClass('icon-line-loader icon-spin').addClass('icon-email2');
	}
	if( data.alert != 'error' && elementRedirect ){
		window.location.replace( elementRedirect );
		return true;
	}
	if( elementAlert == 'inline' ) {
		if( data.alert == 'error' ) {
			var alertType = 'alert-danger';
		} else {
			var alertType = 'alert-success';
		}

		elementResult.addClass( 'alert ' + alertType ).html( data.message ).slideDown( 400 );
	} else {
		elementResult.attr( 'data-notify-type', data.alert ).attr( 'data-notify-msg', data.message ).html('');
		SEMICOLON.widget.notifications( elementResult );
	}
	$.magnificPopup.close();
}

This will definitely work fine. Let us know if we can help you with anything else or if you find any further issues.

Have the same question, or something new?

Sign in to the Canvas dashboard to reply or open your own topic. Canvas owners get direct help from the SemiColonWeb team.

Reply on the dashboard