jQuery AJAX 在 Joomla!在本地工作,但在服务器上给出错误 500

jQuery AJAX on Joomla! works on local but gives error 500 on the server

我已经为 Joomla! 开发了一个统计数据。有 3 AJAX 个调用的组件。整个应用程序在本地完美运行,但当我在实时服务器上测试它时,AJAX 文件根本不起作用。他们 return 500 通过组件调用或直接调用。

我的本地应用:Wamp Server 服务器:DirectAdmin 实时 AJAX 个网址:

http://spaline.pc-games.co.il/administrator/components/com_product/views/reports/funnel.ajax.php?callback=5

http://spaline.pc-games.co.il/administrator/components/com_product/views/reports/callback.php?callback=cart-filling&date=5

http://spaline.pc-games.co.il/administrator/components/com_product/views/reports/filters.php?box_id=5&filter=grey

此外, 关于 AJAX 个文件的路径,我是这样定义的:

define( '_JEXEC', 1 );

// defining the base path.
if (stristr( $_SERVER['SERVER_SOFTWARE'], 'win32' )) {
    define( 'JPATH_BASE', realpath(dirname(__FILE__).'..\..\..\..\..\..\' ));
} else define( 'JPATH_BASE', realpath(dirname(__FILE__).'../../../../../../' ));
    define( 'DS', DIRECTORY_SEPARATOR );

    // including the main joomla files
    require_once ( JPATH_BASE.DS.'includes'.DS.'defines.php' );
    require_once ( JPATH_BASE.DS.'includes'.DS.'framework.php' );

    // Creating an app instance
    $app = JFactory::getApplication('site');
    $app->initialise();
    jimport( 'joomla.user.user' );
    jimport( 'joomla.user.helper' );
...

我检查了路径,没有 404 错误。问题出在我的 AJAX 文件上。我不知道我是否以这种方式定义了 Joomla! header 造成了这个问题,或者问题出在 AJAX 函数本身左右。

问题出在文件路径上。我是这样想出来的:

define( '_JEXEC', 1 );

    define( 'JPATH_BASE', realpath(dirname(__FILE__).'/../../../../..' ));

    // including the main joomla files
    require_once ( JPATH_BASE . '/includes/defines.php' );
    require_once (  JPATH_BASE . '/includes/framework.php' );
    require_once (  JPATH_BASE . '/configuration.php' );

    // Creating an app instance
    $app = JFactory::getApplication('site');
    $app->initialise();
    jimport( 'joomla.user.user' );
    jimport( 'joomla.user.helper' );
...