Editor screen wont close or open again
Editor screen wont close or open again
All changes made in the editor are being updated using the AJAX call. The AJAX success function is being implemented (I have an alert when success). The only thing is the editor screen does not close. If I click outside the screen it will close but I can't open any other screen unless I reload the entire page.
I am sending a few different arrays and constants. The first is an array with the data being modified and a number that represent the key in the datatbase. This is also the array that I am echo at the end of the AJAX call (echo json_encode($EdittedFieldArray))
tableEditor = new jQuery.fn.dataTable.Editor(
{
ajax: function()
{
jQuery.ajax(
{
type: 'POST',
url: '/wp-content/AJAX/EditorSubmit.php',
dataType: 'json',
data: {'AJAX_Data2Submit':DataToSubmit,'AJAX_groupid':GIDField, 'AJAX_TFT': TFTSubmitArray, 'AJAX_TCT': TCTSubmitArray, 'AJAX_NewLDates':NewLArray, 'AJAX_MaxTFT': NewMaxTFT, 'AJAX_MaxTCT': NewMaxTCT, 'AJAX_MaxJN': NewMaxJN},
success: function(d)
{
alert('Entry was successfully modified');
},
error: function (xhr, error, thrown)
{
alert('Error');
}
});
},
table: '#LogTable',
idSrc: 24,
});
This question has an accepted answers - jump to answer
Answers
Hi,
When you override the built in Ajax call that Editor makes by providing your own function to the
ajax
option you must call either the success or error callbacks that are passed into the function. Otherwise Editor can't know that the request is complete.In your code above you don't have any of the arguments being passed into the function shown - update it to be
ajax: function ( method, url, data, success, error )
.Allan
Hi Allan,
Thanks, that worked. I do have a follow up and newbie question though. I create the success and error functions but they are not being called. The editor screen is closing and the edit is taking effect, but the success and error functions are not called
Never mind, I figured it out. My function declaration was wrong
Thanks for your help Allan!
Allan thank you very much, I just found the answer here to my question. lots of thanks.