Add mailchimp subscriber via javascript alert() (sweetalert) -
i using sweet alert display input popup. want add entered email mailchimp subscriber.
i have no problem popup, can me webhook or api call add subscriber?
i'm using example input popup:
swal({ title: "an input!", text: "write interesting:", type: "input", showcancelbutton: true, closeonconfirm: false, animation: "slide-from-top", inputplaceholder: "write something" }, function(inputvalue){ if (inputvalue === false) return false; if (inputvalue === "") { swal.showinputerror("you need write something!"); return false } swal("nice!", "you wrote: " + inputvalue, "success"); });
thanks, dave
hope able solve this, update - here neat way on how this.
sweet alert allows callback on input. assuming using jquery in project, can achieved this.
swal({ title: "an input!", text: "write interesting:", type: "input", showcancelbutton: true, closeonconfirm: false, animation: "slide-from-top", inputplaceholder: "write something" }, function(inputvalue){ if (inputvalue === false) return false; if (inputvalue === "") { swal.showinputerror("you need write something!"); return false; } $.ajax({ url: "<your-url-to-mailchimp-form-submit>", data: { email: inputvalue }, type: "post" }).done(function(data) { swal("woohoo!", "you have subscribed our mailing list", "success"); }).error(function(data) { swal.showinputerror("ohh no, went wrong."); }); });
you can evaluate reply in 'data' variable mailchimp display message correctly.
Comments
Post a Comment