Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I need help to use jConfirm with this existing code (php & Jquery & jAlert).

function logout()
{
  if (confirm("Do you really want to logout?"))
    window.location.href = "logout.php";

}

If I just change confirm to jConfirm this not enough to make it work...

Thanks for your help

Lena

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
478 views
Welcome To Ask or Share your Answers For Others

1 Answer

function logout()
{
  jConfirm('Do you really want to logout?', 'Logout', function(r) {
    if (r)
       window.location.href = "logout.php";
  });
}

EDIT for comments:

function sid(id){
  $_sidId = id;
  jConfirm("Delete System ID for " + id + "?", 'Delete Sid', function(r) {
    if (r){
       window.location.href = "del_sid.php?id=" + $_sidId;
    }
    $_sidId = null;
  });
}

When I saw the script better, it would be desirable to remove the variable "$_sidId" from "if", no matter the response, it would have to clean up the variable.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...