Reputation: 849
I'm after a little help with some JS not behaving. I would like to make it so that I can pass an some JavaScript to affect the end URL destination as below: The end destination being (delete-page.php?id=1
)
<a href ="javascript:deletemessage('id=1')">Delete Page </a>
<script type="text/javascript">
function deletemessage(url) {
$.msgbox("Are you Sure you would like to delete this page", {
type: "confirm",
buttons: [{
type: "submit",
value: "No"
}, {
type: "submit",
value: "Yes"
}]
}, function(result) {
if (result == "Yes") {
window.location.href = "delete-page.php(URL)";
}
});
}
</script>
Any help would be very much appreciated!
Upvotes: 0
Views: 75
Reputation: 36
Replace:
window.location.href = "delete-page.php(URL)";
with: window.location.href = "delete-page.php?" + url;
Upvotes: 1