mercredi 20 décembre 2017

Facebook checkbox plugin redirect after click

I would like to redirect user after the checkbox has been checked and button clicked <input type="button"... Inside FB checkbox plugin, I've added the below jQuery to select it but it didn't work and jQuery could not be able to select the checkbox

   $(".fb-messenger-checkbox").on("change", function(){
    windows.locations.herf="redirecr-URL";
    });

How am I able to redirect user to an URL after the user checked the checkbox and clicked on button?

Below is an example of the entire checkbox plugin code:

<html>
<head>
<script>
    window.fbAsyncInit = function() {
        FB.init({
            appId      : '1815704925309469',
            xfbml      : true,
            version    : 'v2.6'
        });
</script>
   </head>
<body> 
<script>                
    (function(d, s, id){
        var js, fjs = d.getElementsByTagName(s)[0];
        if (d.getElementById(id)) {return;}
        js = d.createElement(s); js.id = id;
        js.src = "//connect.facebook.net/en_US/sdk.js";
        fjs.parentNode.insertBefore(js, fjs);
    }(document, 'script', 'facebook-jssdk')
    );

    function confirmOptIn() {
        FB.AppEvents.logEvent('MessengerCheckboxUserConfirmation', null, {
            'app_id':'1815704925309469',
            'page_id':'1711063052543482',
            'ref':'shopping-cart-company',
            'user_ref':'<?=$random?>'
        });
    }
</script>      

<div class="col-md-7">
    <div class="fb-messenger-checkbox"  
        origin=http://ift.tt/2oUHD5j
        page_id=1711063052543482
        messenger_app_id=1815704925309469
        user_ref="<?=$random?>"
        prechecked="true" 
        allow_login="true" 
        size="large">
    </div>   
</div>


    <input type="button" onclick="confirmOptIn()" value="Confirm Opt-in"/>
</body>




Aucun commentaire:

Enregistrer un commentaire