Redirect after subscribe

Home Forums AB Simple Subscribe WP Plugin Redirect after subscribe

This topic contains 9 replies, has 2 voices, and was last updated by  ab-themes 8 years, 11 months ago.

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #8395

    [email protected]
    Participant

    Hey guys!

    I’m not very code savy, could you help me! Just want to add a redirect after someone submits their email!

    #8403

    ab-themes
    Keymaster

    We haven’t tried this, because the simple subscribe works such that it just slides down and shows a success message on subscribe, but in js folder of the plugin there is a ab-simple-subscribe.js file. There after line 22 try adding

    complete: function(xmlHttp) {
    	if (xmlHttp.code != 200) {
    	  top.location.href = '/some/other/page';
    	}
    }

    where /some/other/page is your redirect page.

    #8411

    [email protected]
    Participant

    Thanks guys! I tried it, placed it at line 23 but it didn’t work, it just reloads the page with a /# after the URL instead of the redirect page. Any thoughts? I tried using a url as well as just the page name alone.

    I really really appreciate the help, I love everything else about this plugin, but client is not budging on wanting a redirect>

    #8419

    ab-themes
    Keymaster

    Try putting the complete URL (with http) and see if it works.

    #8587

    [email protected]
    Participant

    So I tried the full url, it just reloads the current page but with a “/#” after the domain.

    #8590

    ab-themes
    Keymaster

    Yeah, we are not sure if this would work because it’s not how the plugin was designed.

    Try with

    complete: function(xmlHttp) {
    	if (xmlHttp.code != 200) {
    	  window.location.href = "/path/to/thankyoupage";
    	}
    }

    Again, not sure if this will work because all the solutions for redirect happen on success, and our plugin will store the email to the database on success. You could also try with:

    success: function(msg, response){
        if(msg === "OK"){
            $form.animate({ height: '0px' }, 800, function() {
                $form.hide();
            });
            $wrapper.find('.ABss_success_message').delay(400).html(ABss_custom.success).slideDown(600);
            if (response.redirect) {
    	        window.location.href = response.redirect;
    	    }
        }
        else {
            $wrapper.find('.ABss_subscriber_email').addClass('ABss_field_error').attr("placeholder", ABss_custom.error).val('').focus();
        }
    }

    This is a customization of the plugin, so, again, we cannot guarantee this will work.

    #8594

    [email protected]
    Participant

    Thanks for the help! I really appreciate it, first one didn’t work, trying the second, where would I put the URL for the redirect in the second one?

    #8597

    ab-themes
    Keymaster

    This is a JSON object, you’d need to have access to the server for it to work.

    AJAX redirect is a tricky thing because of how the server handles the request.

    #8602

    [email protected]
    Participant

    damn, any recommendation or other plugins you know of that would work?

    #8606

    ab-themes
    Keymaster

    No, no idea.

    If you can find someone with a bit more knowledge on the subject, they could customize the plugin to your liking.

Viewing 10 posts - 1 through 10 (of 10 total)

The topic ‘Redirect after subscribe’ is closed to new replies.