Getting "A system error has occurred (more information)" in preSubmit event
Getting "A system error has occurred (more information)" in preSubmit event
I am getting this error even though I see the JSON that is returned from the server in Reponse tab in the Ajax view as follows:
The format complies with one in the tech note found in https://editor.datatables.net/manual/server#Edit.
(I am afraid that I can't provide the link yet.)
Any suggestions?
{
"data": [
{
"insCo": "A",
"eff": "2014-10-24",
"insType": "B",
"groupID": "",
"payerID": "C",
"payerName": "D",
"term": "2078-12-31",
"rateSchedule": "E",
"DT_RowId": "123456"
}
]
}
The code snippet for preSubmit is as follows:
editor.on( 'preSubmit', function ( e, data, action ) {
var request = new XMLHttpRequest();
if (action == "create") {
// do somthing
}
else if (action == "edit") {
alert ("preSubmit---edit");
payerID = editor.get( 'payerID' );
payerName = editor.get( 'payerName');
rateSchedule = editor.get( 'rateSchedule' );
insCo = editor.get( 'insCo');
insType = editor.get( 'insType' );
groupID = editor.get( 'groupID');
eff = editor.get( 'eff' );
term = editor.get( 'term');
console.log(JSON.stringify(data)); // Display data
var jsonOb = JSON.stringify(data);
request.open("POST", "/myPayers/UpdateData", true);
request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
request.send('json='+encodeURIComponent(jsonOb));
}
This discussion has been closed.
Answers
If you are getting that specific error message it means that the response from the server is not valid JSON. There must be something other than your JSON data that is being returned from the server. It is possible this could be the invisible BOM characters for UTF8 if there are present in your source files, but more likely there is a warning message or some other data that is making it not valid. Without a link, I'm afraid I can't say for certain what it is.
Allan
I am having the same problem. the data returned is :
The ajax request does update the data in the database. It just throws this error. Any help will be appreciated.
Thanks.
What version of jQuery are you using? Editor 1.6.0 has an issue with anything older than 1.12.0. I'm going to release a fix for that tomorrow.
Allan
Hi there,
im also getting showed this error. Using jQuery 1.12.3. Aside from getting shown this error there is no effect. Everything works. Could you tell me the class to hide this error message? It is shown to short to inspect.
The error you are seeing will occur if the server returns anything other than valid JSON to the Ajax request that Editor sends. The question therefore is, what is the server returning instead of valid JSON? Very often there will be an error message stating the error.
The information in the tech note explains how you can look at what the server is returning in the browser.
Regards,
Allan