I'm trying to pass a value from a html page to a JS file.
HTML part:
<a href="#" id="pagejs_general_delete_wizardresultid"><i class=" icon-bin" ></i> Delete</a>
JS file:
$('#pagejs_general_delete_wizardresultid').on('click', function() {
swal({
title: "Are you sure?",
text: "Are you sure you want to delete item with reference <wizardresultid here>? This can not be undone!",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#EF5350",
confirmButtonText: "Yes, delete it!",
cancelButtonText: "No, cancel!",
closeOnConfirm: false,
closeOnCancel: false
},
function(isConfirm, wizardresultid){
if (isConfirm) {
swal({
title: "Deleted!",
text: "The record has been deleted.",
confirmButtonColor: "#66BB6A",
type: "success"
});
}
else {
swal({
title: "Cancelled",
text: "Nothing has been changed.",
confirmButtonColor: "#2196F3",
type: "error"
});
}
});
});
I'm unsure how I can pass the variable wizardresultid
from HTML to the javascript. I can find examples how to pass it a function from a button, but not how to do it from a link.
Furthermore, I'm trying to display the wizardresultid
in the text. Is that the correct way to do that:
text: "Are you sure you want to delete item with reference" + wizardresultid + "? This can not be undone!"
Thanks for your help!!!