Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I hope it's not bad form to answer my own question, but I have it working. I know it's an edge case, but maybe someone will find it helpful.</p> <p>Code:</p> <pre><code>&lt;script type="text/javascript"&gt; $(document).ready(function() { var create_callback = function(data) { if (data.status == 'OK') { $.fancybox({'href': '#inline_message'}); } else { $.fancybox({'href': '#inline_message'}); $("#inline_message").html('&lt;h3&gt;Oops! Looks like an error occurred.&lt;/h3&gt; &lt;p&gt;Please check the email address you entered and try again.&lt;/p&gt;'); } } $('#notify_button').click(function(event) { event.preventDefault(); BISPopover.create($('#mce-EMAIL').val(), $('#product-select :selected').val()).then(function(data) { var BISData = data; // keep a reference to the response from the app var isChecked = $('#chkSelect').is(':checked'); if(isChecked) { url = 'http://YourListURL'; EMAIL = $("#mc_form input[name=EMAIL]").val(); $.ajax({ type: "POST", url: url, data: {EMAIL : EMAIL}, dataType: 'json', complete: function(){ create_callback(BISData); if (BISData.status == 'OK') { $.fancybox({'href': '#inline_message'}); } else { $.fancybox({'href': '#inline_message'}); $("#inline_message").html('&lt;h3&gt;Oops! Looks like an error occurred.&lt;/h3&gt; &lt;p&gt;Please check the email address you entered and try again.&lt;/p&gt;'); } } }); } else { create_callback(BISData); } }); }); }); &lt;/script&gt; &lt;div id="BIS_form"&gt; &lt;form id="mc_form"&gt; &lt;h3 id="notify-title"&gt;Notify me when this is back in stock:&lt;/h3&gt; &lt;input type="email" id="mce-EMAIL" name="EMAIL" value="Email address" onfocus="value=''"/&gt; &lt;button id="notify_button" class="first"&gt;Submit&lt;/button&gt; &lt;input type="checkbox" id="chkSelect" /&gt;&lt;span&gt;Add me to the Newsletter&lt;/span&gt; &lt;/form&gt; &lt;/div&gt; </code></pre> <p>It throws an error in the console, but it still works. This is probably due to the origin being on a different server. I'm open to suggestions on how to improve this. You can see it functioning here (you might need to play around to find an out of stock variant):</p> <p><a href="http://store.manitobah.ca/collections/mukluks/" rel="nofollow">http://store.manitobah.ca/collections/mukluks/</a> </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload