i am preparing an applicaion in PHP, and using lots of AJAX. So i am doing some ajax and calling classess through ajax includes page but things not working error occuring:
No such file in directory
Below is a ajax in which i have included a page for calling a class.
$.ajax({
url: "includes/xyz.php",
type: "post",
data: '&xyz=' + zyx + '&task=delete',
success: function(result) {
alert(result);
$('#loaders').hide();
}
});
And below is how i am calling class on included page.
<?php
if($_POST['task'] == "xzs")
{
include '../core/init.php';
$DeleteObj = new deleteCls($_POST['xyz']);
echo $DeleteObj->deletion();
}
but result is
no such directory.
Please help. Thanks in advance.
</div>
I suggest you to change this code :include '../core/init.php';
to some code like this : include __DIR__.'../core/init.php';
. Also you can echo __DIR__;
to see your work dir;
Change from
if($_POST['task'] == "xzs")
To
if($_POST['task'] == "delete")