jquery - How can I have impromptu not continue until submit is done and exits -


i'm using jquery impromptu library , not understanding async nature of it. i've got code below want redirect after prompt run. don't want next line of code execute if data.redirectpage statement true.

               success: function (data) {                     if (data.redirectpage == "hackathonregistration") {                         $.prompt("your code has been accepted , redirected hackathon registration page",                         {                             submit: function() {                                 window.location.href = "/register/hackathon";                             }                         });                     } 

from read fast impromptu, code looks ok.
except missing } close success function... ;)

and no buttons on submit try trigger.
that important and.

try :

success: function (data) {     console.log(data.redirectpage);     if (data.redirectpage == "hackathonregistration") {         $.prompt("your code has been accepted , redirected hackathon registration page",         {             buttons: { "yes": true, "no": false },             submit: function(e,v,m,f) {                 // use e.preventdefault() prevent closing when needed or return false.                 // e.preventdefault();                 console.log("value clicked was: "+ v);                 if(v){                     window.location.href = "/register/hackathon";                 }             }         });     } } 

i suppose v bolean true/false.
said, read real fast on impromtu.

personnaly, use sweetalert. alternative... may easier.


Popular posts from this blog

php - How should I create my API for mobile applications (Needs Authentication) -

5 Reasons to Blog Anonymously (and 5 Reasons Not To)

Google AdWords and AdSense - A Dynamic Small Business Marketing Duo