LOCALHOST works with datatables editor, Remote Server doesn't.
LOCALHOST works with datatables editor, Remote Server doesn't.
Hi,
I am very new to the Datatables Editor, and have run into a very odd problem which I have tried to diagnose using the Chrome developer tools to follow the AJAX calls being made as per the Documentation.
I've been trying to create a parent/child page as per https://datatables.net/blog/2016-03-25, and seem to have got things working on my local server running PHP 7.1.
However when I run the code on my remote server, I get a problem with the Ajax call in the child datatable, specifically returning an internal server error when running the line:
xhr.send( options.hasContent && options.data || null );
inside JQUERY. This line of code returns "Failed to load resource".
The code inside the HTML file relating to the specified datatable looks like this:
var scenesEditor = new $.fn.dataTable.Editor({
ajax: {
url: 'tw_controllers/jb_places_scenes_join.php',
data: function (d) {
var selected = placesTable.row({selected: true});
if (selected.any()) {
console.log("A row was selected - scenes");
d.id_place = selected.data().tw_place.id;
console.log(d.id_place);
}
}
},
table: '#scenesTable',
placesTable refers to the Parent Table controlling what is shown in scenesTables which is the child table.
You can see there is a bit of debug code in there to make sure that the primary key from the Parent table has been set correctly - and it has.
I have checked that the database on the localhost is the same as the one on the remote host.
When this is run on the localhost it works fine.
When it is run on the remote server it fails.
I am pretty new to Javascipt, so am unsure how to proceed to figure out what's going on.
Thank you for any help.
JB
Answers
Have you checked the server's error logs? That would be the first place I would suggest checking. Also what is the response code from the server for the request? 500, 404, 401, something else?
Thanks,
Allan
Hi Allan,
Thanks for taking the time to reply. I have lodged a support ticket with the host provider.
The error is a 500 error.
JB