My JavaScript code below is designed to go to the correct URL with the corresponding ID from the model. However, I am uncertain about how to hide it if the URL does not contain a model ID.
function lnkBack_Confirm() {
var bResponse = confirm('Are you sure you want to go back to the Details Page?');
if (bResponse === true) {
////console.log("lnkBack_Confirm clciked.");
var url = '@Url.Action("NewHireDetails", "Home", new { id = Model.ID })';
window.location.href = url;
}
return bResponse;
}
I simply want to find a way to hide it when the URL lacks an 'id' parameter equal to 'Model.ID'. Can someone assist me with this issue? Thank you in advance.