Editor.remove sends empty ajax request
Editor.remove sends empty ajax request
Hi Allan,
I'm facing a strange problem:
In the table I have two buttons, one for editing, the other for deleting the entry.
$('#tbl').on('click', ...) is triggered for both and edit works perfectly fine. But...
Sometimes also editor.remove works as expected, but most of the time it's sending an empty POST request to the server.
In onPreSubmit in can see, that the JSON is ok, but nothing is send.
I'm using the same mechanism in several tables it working. Only in one specific table the problem occurs.
Best regards
Rudi
Answers
Hi Rudi,
Can you give me a link to a page showing the issue so I can help to debug it?
Allan
Further information:
Even if I try to send the ajax request from preSubmit directly, the response contains no data. So it looks like a problem with jQuery and ajax.
jQuery is fairly thoroughly tested - I would be surprised if there was an Ajax bug in it. If you can give me a link to a page showing the issue I can take a look.
Allan
Hi Allan,
thanks for your fast response. It's a little difficult to provide you a direct access, because it's running on an embedded system which doesn't have a connection to the internet.
But here the data (opts) directly before calling ajax(opts) in _ajax shown in the Firefox debugger once for the failing and the other for a working request:
Most often failing request (empty POST):
(opts : {…}
data : {…}
action : "remove"
data : […]
1 : {…}
etr : 0
id : 1
name : "Test"
scr : 0
src : "Test/Output"
src_id : 3
srv : 0
std : 257
ts_id : 0
proto : {…}
proto : {…}
proto : {…}
dataType : "json"
factory/Editor.prototype._submit/<()
factory/Editor.prototype._submit/<()
type : "POST"
url : "/config/mpeg/monitors"
proto : {…}
)
Working one:
opts : {…}
data : {…}
action : "remove"
data : […]
4 : {…}
chn : 5
id : 4
mpeg_rs : 0
name : "Test1"
rate : 0
stream : ""
stream_id : 0
tei : 1
type : "dvb-asi"
use : 0
proto : {…}
proto : {…}
proto : {…}
dataType : "json"
factory/Editor.prototype._submit/<()
factory/Editor.prototype._submit/<()
type : "POST"
url : "/config/mpeg/sources/dvbasi"
proto : {…}
Perhaps you can show me your Editor code?
Allan
Of course:
(```)
(```)
This is the one causing the issue I presume?
So you click on that and then click on the confirm button to delete the row, and sometimes it sends an empty request? I really would need to see a test case to be able to debug that I'm afraid.
Does
$(this).closest("tr");
always resolve to be a DataTables row? You don't have any inner tables or anything?Allan
Hi Allan,
yes, your assumptions are 100% correct. I'm always getting the correct row (no inner tables etc.), getting down to the ajax request with (to my opinion valid data) and getting a empty POST as a result of this.
I could give you access to a unit via TeamViewer, NoMachine, or RemoteDesktop, everything else would become a nightmare and take ages just because of our IT department.
The strange thing is, that the same mechanism work for all other tables and editors perfectly, just facing the problem with this particular table.
If you could PM me the details (click my name above and then the "Send message" button, that would be great.
Thanks,
Allan