4

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

nemke
  • 2,440
  • 3
  • 37
  • 57
lena
  • 119
  • 1
  • 12

1 Answers1

6
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.

andres descalzo
  • 14,887
  • 13
  • 64
  • 115
  • Thanks a lot it is working perfectly! I have tried to do the same for this other confirmation without success... Could you help me with this one too? function sid(id) { if (confirm("Delete System ID for " + id + "?")) window.location.href = "del_sid.php?id=" + id; } – lena Nov 09 '09 at 20:52