Sunday, June 2, 2024
 Popular · Latest · Hot · Upcoming
134
rated 0 times [  140] [ 6]  / answers: 1 / hits: 77731  / 12 Years ago, tue, september 25, 2012, 12:00:00

This is a piece of my function with the question in it:



function deletePost() {
var ask = window.confirm(Are you sure you want to delete this post?);
if (ask) {
window.alert(This post was successfully deleted.);

/* How to redirect to another page on confirm? */

}
}


Pure Javascript needed.


More From » javascript

 Answers
19

try this:



function deletePost() {
var ask = window.confirm(Are you sure you want to delete this post?);
if (ask) {
window.alert(This post was successfully deleted.);

window.location.href = window-location.html;

}
}

[#82913] Monday, September 24, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
annalise

Total Points: 210
Total Questions: 94
Total Answers: 102

Location: The Bahamas
Member since Tue, Apr 27, 2021
3 Years ago
;