This question already has an answer here:
i have this code which call a php file to get the data with ajax
function checkInfo($campaignId){
//var idc = JSON.stringify($campaignId);
var data = {
"action": $campaignId
};
$.ajax({
type: "POST",
url: '/modules/SomeFolder/testAjax.php',
dataType: 'json',
data: data,
success: function(results){
alert(results);
},
error:function (data){
console.log(data);
}
});
}
testAjax.php
require_once ('Mandrill.php'); //displays an error.
The mandrill file has the class Mandrill but also have require_once('somefile') which causing the error class not found
EDIT 1 The mandrill class works fine i get the error only when i do a ajax call of hte file.
**Mandrill.php**
require_once('libraries/src-api/soemthing/Mandrill.php')
class EmailCampaign_mandrill {
//code here
}
Error that i get in console log require_once(libraries/soemthing/Mandrill.php): failed to open stream: No such file or directory in
</div>
The path you could see in the error message require_once(libraries/..soemthing/Mandrill.php)
is badly formatted: it lacks a slash between ..
and soemthing
. It should be like require_once("libraries/../soemthing/Mandrill.php")