Server answer with javascript in inline editing mode?
Server answer with javascript in inline editing mode?

Hello,
is it possible, to answer an inline editing ajax request with javascript code (without the error "Reason: SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data")?
Perhaps something like this:
<script type="text/javascript">
$("div#table_jobsopen_wrapper .buttonOpenJobsAssign").notify("Daten erfolgreich
gespeichert", "success");
table_jobsassigned_1.row ("#jobgroup-1_jobId-4").remove ().draw (false);
table_jobsassigned_2.row.add ($("<tr id=\"jobgroup-2_jobId-4\">
<td class=\"pan\">PAN-221037<\/td>
<td class=\"jobNo\">156343<\/td>
<td class=\"customerName\">Testkunde 2<\/td>
...
<td class=\"avNote editable\">-<\/td>
<td class=\"jobgroupName editable\">Linie 2<\/td><\/tr>")[0]).draw (false);
</script>
It unexpectedly works :-), but shows the error message above .
This discussion has been closed.
Answers
The ajax option allows you to pass in a function, you can then decide whether to make a server call or local call.
See the last section of https://editor.datatables.net/reference/option/ajax
My config:
This works:
data: data
But i am using the following, and that completly omits the sending of the parameter array (data):
And i got again the Error message from the editor: "Reason: SyntaxError: JSON.parse: unexpected end of data at line 1 column 1 of the JSON data".
Is there now way to bypass the editor error message?
Not really - Editor by default expects JSON in reply. Indeed, even in your own Ajax method you are telling it to expect JSON (
dataType: "json"
) and it sounds like the server is not returning with JSON.The only way to bypass it would be to generate the JSON that Editor expects on the client-side and pass that into the
success
callback function.Because you aren't submitting the parameters from Editor. You would need to do something like:
Allan