function RequestValidation() {
$(".RequestTrigger").on("click", function () {
var selectedButton = $(this);
var arr = [];
if ($(this).data('multiple') == true) {
var ids = $('input:checkbox:checked.check-box').map(function () {
var value = $(this).data('entityid');
if (!isNaN(value)) {
arr.push(value);
}
});
} else {
var value = selectedButton.data('entityid');
if (!isNaN(value)) {
arr.push(value);
}
}
var data = {
ids: arr
};
$.ajax({
url: selectedButton.data('url'),
data: data,
type: 'post',
success: function (result) {
$('#largeModal').modal('hide');
$('#ApprovalTable').html(result);
checkBox();
accountRequestValidation();
}
});
});
};
This functions binds to buttons with .RequestTrigger
If the button has a data-attribute called multiple with a value of true
the functions gets the entity-id of every checkbox and passes the values to the ajax request or if the value of multiple is false
then it just gets the entity-id of the button clicked
C#
? Does the code work as you expect it to? \$\endgroup\$