Below is the ajax request.
$.post(\'delete.php\', {\'deletearray\':deletearray, \'dir\':dir}, function(deleted, undeleted){
if(undeleted == 0) {
aler
First thing-
Use $_POST['deletearray'] instead of $_POST[deletearray]
Second thing-
You cannot return different variables from the PHP scrtipt, every thing you print there is returned in the ajax callback, so just write this-
PHP
json_encode(array('totalDeleted' => $deleted, 'totalUndeleted' => $undeleted));
AJAX
...
function(response){
response=JSON.parse(response);
console.log(response);
}