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

Popular posts from this blog

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

sql - MySQL query optimization using coalesce -

unity3d - Unity local avoidance in user created world -