• 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 5 years, 4 months 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)
  • The topic ‘Is there a JS callback that closes and sets cookie on validation?’ is closed to new replies.