Support » Plugin: Popups - WordPress Popup » Is there a JS callback that closes and sets cookie on validation?

  • digi57

    (@digi57)


    I a using a form provided by a company that does online booking, customer relation management, smart marketing, etc. The form connects to their API and has the following Javascript that validations API connection success:

    $(document).ready(function() {
    $(“form”).submit(function(e){
    var formdata = $(this).serialize();
    showLoader();
    e.preventDefault(e);
    $.ajax({
    url: ‘/OpportunityAPI.php’,
    type: ‘POST’,
    data: formdata,
    success: function(msg) {
    hideLoader();
    $(“#form”)[0].reset();
    console.log(msg);
    if(msg.includes(“success”)){
    alert(‘Opportunity successfully created!’);
    }
    else
    {
    alert(‘Something went wrong. Please check the Configuration !’);
    }
    }
    });

    return false;
    });
    });

    Is there a callback where I can replace “alert(‘Opportunity successfully created!’);” with a callback that sets the conversion cookie and closes the popup?

    • This topic was modified 1 month ago by digi57.
Viewing 1 replies (of 1 total)
  • Plugin Support gonzalesc

    (@gonzalesc)

    Hi.

    First, your script must dependent on public/assets/js/public.js
    So you can use the SPU functions like this example:

    // Close popup with ID 15 and conversion
    const $popup_id = 15, $conversion = true;
    SPU.hide($popup_id, $conversion);

    Regards

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.