如果您嘗試訪問模塊與Ajax調用正確的方法是如下
$document = &JFactory::getDocument();
$renderer = $document->loadRenderer('module');
$Module = &JModuleHelper::getModule('mod_fmDataGrid');
$Params = "param1=bruno\n\rparam2=chris";//This will only required when you pass module params through code
$Module->params = $Params;
echo $renderer->render($Module);
爲more
如果你正試圖從當前頁面訪問它,你必須加載框架工作太像在下面,但它不是一個好習慣。
define('_JEXEC', 1);
define('JPATH_BASE', dirname(__FILE__));//this is when we are in the root
define('DS', DIRECTORY_SEPARATOR);
require_once (JPATH_BASE .DS.'includes'.DS.'defines.php');
require_once (JPATH_BASE .DS.'includes'.DS.'framework.php');
對於more
設法使一個AJAX調用任何現有的組件控制器等的下方。
jQuery.ajax ({
type: "GET",
url: "index.php?option=com_virtuemart&controller=productdetails&ajax_request=1&task=addItemToWaitlist",
//controller components controller name
//task the function inside controller.
data: data,
success: function(data) {
alert(data)
}});
此錯誤是由於joomla框架無法從您的頁面訪問 –