I am getting a "
caught TypeError: Illegal invocation
" in the console everytime I click to submit a form.
I need the data to be passed to the backend to be handled but this error is blocking it.
What could be causing this error and how can I fix this?
Thank you.
What I have tried:
I tried adding processData: false property in the ajax which helps avoid this error. But this is not the fix that I am looking for since no data is being sent to the backend this way.
The following is the js function and where the error is being triggered:
submitEdit: function () {
var $modal = $('#TransactionEdit')
$.ajax({
method: "POST",
url: $modal.find('#url').data("url"),
data: {
Id: $modal.find('#TransactionRow_Id').val(),
StatId: $modal.find('#TransactionRow_EntryStatus option:selected').val(),
PaymentDay:$modal.find('#TransactionRow_PaymentDate').val(),
DocumentDate:$modal.find('#TransactionRow_DocumentDate').val(),
Amount: $modal.find('#TransactionRow_Amount').val(),
AmountLCY:$modal.find('#TransactionRow_AmountLCY').val(),
Tax: $modal.find('#TransactionRow_TaxID option:selected').val(),
RateType: $modal.find('#TransactionRow_RateType option:selected').val(),
DocumentNumber:$modal.find('#TransactionRow_Reference').val(),
Description:$modal.find('#TransactionRow_Description').val(),
BillingText:$modal.find('#TransactionRow_PaymentDescription').val(),
SpecialGLIndicatorId:$modal.find('#TransactionRow_SpecialGLIndicatorId option:selected').val(),
PaymentTermId: $modal.find('#PaymentTermId option:selected').val(),
PostKeyId: $modal.find('#PostKeyId option:selected').val(),
TimeStamp: $modal.find('#TimeSpan input:selected').map(function (i, e) { return $(e).attr('data-date'); })
},
error: function () {
alert("Error");
}
}).done(function () {
$modal.modal("hide");
$modal.html('');
});
}