What's new
  • Welcome to PHCorner Forums. Take a moment to Sign up and gain unlimited access and extra privileges that guests are not entitled to, such as: All that and more! Registration is quick, simple and absolutely free. Join our community today!

Help Javascript Confirm not working

halagao72

Addict
Established
Joined
Dec 22, 2015
Messages
430
Reaction score
48
Age
20
, Last edited:
Guys bakit pumupunta parin sa true kahit cancel pinipindot ko sa confirm box ? at nagdedete parin yung data sa data base kahit cancel pinidot ko... pa help po ...
Thank you in Advance.

<script>
function mydelete() {
var txt;
var r = confirm("Do you want to Delete this?");
if (r == true) {
alert("Deletion Success!");
url: 'delete.php';
} else {
alert("Deletion Canceled");
}
}
</script>
 

_iamkurt

Addict
H halagao72

working naman.

if ayaw pa din, try


JavaScript:
function mydelete() {
    var txt;
    var r = confirm("Do you want to Delete this?");
    
    if (r) {
        alert("Deletion Success!");
        url: 'delete.php';
    } else {
        alert("Deletion Canceled");
    }
}
 

noname18

Forum Veteran
Tama naman ah...

JavaScript:
<script>

  const deleteMe = () => {

    const r = confirm("Do you want to Delete this?");
  
    if (r) {
        alert("Deletion Success!");
    } else {
        alert("Deletion Canceled");
    }

  }

  deleteMe();

</script>
 

halagao72

Addict
H halagao72

working naman.

if ayaw pa din, try


JavaScript:
function mydelete() {
    var txt;
    var r = confirm("Do you want to Delete this?");
  
    if (r) {
        alert("Deletion Success!");
        url: 'delete.php';
    } else {
        alert("Deletion Canceled");
    }
}
I mean nagdedelete po yung data kahit na napindot yung cancel button kasi naka data base po ako haha
 

halagao72

Addict
Tama naman ah...

JavaScript:
<script>

  const deleteMe = () => {

    const r = confirm("Do you want to Delete this?");
 
    if (r) {
        alert("Deletion Success!");
    } else {
        alert("Deletion Canceled");
    }

  }

  deleteMe();

</script>
I mean nagdedelete po yung data kahit na napindot yung cancel button kasi naka data base po ako haha
 

noname18

Forum Veteran
I mean nagdedelete po yung data kahit na napindot yung cancel button kasi naka data base po ako haha
Yong question mo kasi iba sa reply mo hehehe. Mas ok siguro kung SPECIFIC yong tanong with screenshots. Wala namang logic doun sa false. Baka message alert lang na nag de-delete siya?
 

pixkit

Addict
The reason why your code still does a delete is because somewhere in your codebase is you are STILL calling the delete where it shouldn't be called in the first place.

But I'm sure the delete is NOT being called in the code snippet you posted above. The true bug here is you don't have full understanding of your codebase here since you don't know where delete is supposed to be called.
 

bakakon

Leecher
, Last edited:
Tawagin mo yung API mo na mag dedelete kung nag `true` yung confirmation mo.

JavaScript:
(function() {
  if (confirm('Delete confirmation message')) {
    console.log('true');
    // call delete API here
  }
})();
 

Unanswered Topics

Top