Home » Php » PHP class called with jQuery $.post can't find extends class

PHP class called with jQuery $.post can't find extends class

Posted by: admin February 25, 2020 Leave a comment

Questions:

I’m trying to instanciate a inherited class Popup using jQuery $.post

$("#tableInscrits").on("click", "i", function() {
       var mId=($(this).attr('name'));
       $.post('pages/controleurs/Popup.php',{Id:mId,Action:"read",View:"PopupAuto"},function(data) {

If Popup class is not inherited, it succeds.
But this fails :

class Popup extends Controleurs {
...
}

In /var/log/apache2/error.log :

PHP Fatal error:  Class 'Controleurs' not found in /<PATH_TO>/Popup.php on line 10, referer: <URL>

Controleurs exists, as i use it in another inherited class (where i call the $.post method)

autoload is up-to-date by composer.phar update.

I tried to create a fork (ControleursII), but it failed too

Any suggestions ?

EDIT :
When you call $.post, include_path and magic constants changes. So, if you called a php which refers to another php etc … it’s cascading fails. My experience is you can only call ONE php file which works standalone, with no include or require. Waste of time.

How to&Answers: