I'm new to Wordpress so please be gentle.
I succesfully created a Admin submenu page. The submenu page itself is supposed to show a list of files that are in 'wp-admin/whatever/myFolder' with buttons attached and it does. Here is a button example:
<li>$file</li><input type='button' value='choose' data-filename='$file' data-path='$fullPath' name='choose' />
I $_POST the data to the file "myPost.php" on click, using AJAX with jQuery like the following in the same .php file that creates my submenu:
$.ajax({
type: "POST",
url: '../wp-content/plugins/myPlugin/myPost.php',
data: {
fileName : $(this).data('filename'),
filePath : $(this).data('path'),
},
success:function(data) {
console.log(data);
},
error: function(errorThrown){
console.log(errorThrown);
}
});
The POST works flawlessly. The problem I'm facing is, that the "myPost.php" file can't execute further Wordpress functions like "add_action" or which ever, because the defined ('ABSPATH') at the beginning of "myPost.php" is always false.
Thanks for any help.