I have a form I try to submit that can potentially have a lot of data and some users get a simple alert 'Undefined' when trying to submit. I've tried to replicate the issue on my local machine, on our test server and in production and I have no issues with all 3 environments.
I receive no error logs from our logging which leads me to think that it is an issue in the browser or front end since I would probably get a log message if it reached the backend.
...
<form id="WorkplaceIncidentForm" class="incidentReport text-center">
...
<button type="button" class="btn btn-info btn-lg" onclick="SendForm()">Submit</button>
...
function SendForm() {
var form = $("#WorkplaceIncidentForm").serialize();
var message = checkInputs();
if (message === "valid") {
$.ajax({
type: "POST",
url: "@Url.Action("Submit","Form")",
data: form,
dataType: 'json'
})
.fail(function (result) {
alert(result.message);
})
.done(function (result) {
if (result.success) {
alert('Successfully submitted!')
window.location.href = '../Form/ReportSubmitted';
}
else {
alert(result.message);
}
});
}
else {
alert('Please fill in ' + message + ' field.');
}
}