我開始之前,我發現這一點:Create a basic MailChimp signup form using their API這似乎做我想做的,但這裏的警告:Shopify mailchimp整合
形式我是有Shopify上。這是一款允許客戶在產品庫存時收到通知的應用程序。我想要一個複選框以允許他們訂閱我們的通訊。所以最終的結果是,它仍然會發布到應用程序,但將它們添加到我們的時事通訊數據庫。
上述解決方案可以遠程完成嗎?即我把PHP文件放在我的主網站上,並有ajax指向url?有沒有更簡單的方法來做到這一點?
<script type="text/javascript">
$(document).ready(function() {
var create_callback = function(data) {
if (data.status == 'OK') {
$.fancybox({
'href': '#inline_message'
});
//alert(data.message);
} else {
//alert("Oops! An error occurred. Please check the email address you entered and try again.");
$.fancybox({
'href': '#inline_message'
});
$("#inline_message").html('<h3>Oops! Looks like an error occurred.</h3> <p>Please check the email address you entered and try again.</p>');
}
}
$('#notify_button').click(function(event) {
event.preventDefault();
BISPopover.create($('#notify_email').val(), $('#product-select :selected').val()).then(create_callback);
});
$('#BIS_form_submit').submit(function() {
var isChecked = $('#chkSelect').is(':checked');
if(isChecked){
$.ajax({
url: 'http://www.myURL.com/inc/store-address.php', // proper url to your "store-address.php" file
data: $('#BIS_form_submit').serialize(),
success: function(msg) {
$('#message').html(msg);
}
});
return false;
}
});
});
</script>
<div id="BIS_form">
<form id="BIS_form_submit">
<input type="hidden" name="ajax" value="true" />
<h3 id="notify-title">Notify me when this is back in stock:</h3>
<input type="email" id="notify_email" value="Email address" onfocus="value=''"/>
<button id="notify_button" class="first">Submit</button>
<input type="checkbox" id="chkSelect" /><span style="font-size:10px;position:relative;top:3px;left:3px;">Add me to the Newsletter</span>
</form>
</div>
我想我的印象是,該商店address.php在做這一點。 – Patrick 2013-05-03 18:22:54