I know its much to ask, but maybe someone please can have a quick look at this file of an abandoned WordPress plugin, which is not working as it should. The Ajax post data results in an empty array, thus the script dies with an error. I guess something in WordPress changed, which makes this Script now failing. What i found out is that the Ajax call with Action
mbh_save_bounce_settings
is posting to the function which checks the data with
if(isset($_POST['data']['bounce']) && is_array($_POST['data']['bounce'])){
The above statement is not ture because the array $_POST['data']['bounce']) is empty and thus ending in the custom error from the "else" part. The data itself coming from the ajax call
'data': settings_data,
is working in the console log. But it's not getting into the if statement. There is no error displayed in console. Neither in the PHP log nor in the DEV console.
This is the file:
phpside? Or in the console of your browser? Can you include the error in your question?if(isset($_POST['data']['bounce']) && is_array($_POST['data']['bounce'])){, since this statement is not true.$_POST['data']['bounce']is not set after the ajax post.var settings_data = $(this).serializeObject();- that does not appear to be a core jQuery function, but this plugin, plugins.jquery.com/serializeObject - and that serializes form data as JSON. PHP does not populate $_POST for JSON input.data[bounce[hostname]]:- is this then the correct way to call the check viaisset($_POST['data']['bounce'])?