2017-01-24 1 views
1

Joomla! 3 개의 AJAX 호출을 가진 컴포넌트. 전체 응용 프로그램은 로컬 완벽하게 작동하지만 라이브 서버에서 테스트 할 때 AJAX 파일이 전혀 작동하지 않습니다. 컴포넌트를 통해 또는 직접 호출하는 동안 500을 반환합니다.jQuery AJAX on Joomla! 로컬에서 작동하지만 서버에 오류 500을 표시합니다.

내 로컬 응용 프로그램 : Wamp Server [서버 : DirectAdmin 라이브 AJAX URL을 :

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를 정의한 방법에 대해서는 잘 모른다! 헤더가이 문제를 만들거나 AJAX 함수 자체에 문제가 있습니다.

+0

왜 필요한 작업을 수행하는 구성 요소를 만들지 않습니까? 이렇게하면 Joomla를 복사하는 것에 대해 걱정할 필요가 없습니다! 응용 프로그램 초기화 코드를 사용하면 기능에 집중할 수 있습니다. –

+0

비 Joomla 구성 요소를 의미합니까? 그 말은, 프로젝트가 기존 Joomla!에 통계를 추가하고 있다고 말한 것입니다! 내가 AJAX와 내가 사용했던 방식을 사용하지 않는다면, 나는 많은 문제에 직면하게 될 것이다. 그러나 당신의 의미에 대해 내가 틀렸다면, 나는 당신의 생각에 대해 더 많은 것을 발견하게되어 기쁩니다. –

+0

기본 Joomla 구성 요소를 의미합니다. 경로에 이미 "com_product"가 있습니다. index.php? option = com_product & view = reports & layout = filter | funnel | callback과 같은 URL을 사용할 수있는 방법으로 구현하는 것이 좋습니다. –

답변

0

파일 경로에 문제가 있습니다. 이 방법으로 알아 냈습니다 :

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'); 
...