I have this jquery code:
$("#deletec-box").dialog({
autoOpen: false,
resizable: false,
height:230,
modal: true,
buttons: {
"Confirm": function() {
window.location = 'hrefurlfromclick';
$(this).dialog("close");
},
Cancel: function() {
$(this).dialog("close");
}
}
});
$("#deletec-confirm").click(function() {
$("#deletec-box").dialog("open");
return false;
});
Then in the page I have a link that calls the dialog:
<a href="?action=delc&cid=2" id="deletec-confirm">Delete</a>
My question is how do I get the value of href so if the person does confirm it loads the link they originally clicked?
Get it with attr
Do you have to use the jQuery UI dialog? You could instead use the confirm box, like this:
This way, if the cancel button is hit the links original action is prevented, otherwise the links is free to perform it's original action.
Here's a quick example.
You can get the href attribute with:
$('#deletec-confirm').attr('href');
Your code now looks like: