如何使AJAX调用自己从的Joomla!模块? [英] How to make AJAX call to myself from Joomla! module?

查看:132
本文介绍了如何使AJAX调用自己从的Joomla!模块?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写了一个模块,依赖一些第三方设备(负载,分析和放大器;显示器)。有时需要5秒就回应,所以我试图ajaxify这一部分。

I wrote a module that is dependent on some third party device (load, parse & display). Sometimes it takes 5 seconds for it to respond so I tried to ajaxify this part.

我的Joomla!模块准备以及code与AJAX(MooTools的),但我想不通的网址是Joomla访问我的模块PHP文件注入! (有点像/index.php?option=com_content)。我可以硬code和访问它(/modules/mod_a/xyz.php),但我会碰上直接访问不准,这是没有问题的,但我不具备的Joomla!背景我pretty的非常想念。

My Joomla! module is ready as well as code with AJAX (mootools) but I can't figure out the URL to access my module php file "infused" by Joomla! (something like /index.php?option=com_content). I can hardcode and access it (/modules/mod_a/xyz.php) but I will run into "direct access not allowed" which is no trouble, but I don't have the Joomla! context which I pretty much miss.

我所发现使用的组件,我非常希望避免的。

All I found utilizes components which I would very much like to avoid.

感谢您的建议,

问候,

马立克

推荐答案

我也写了简单的组件我可以(不MVC):

I did write the simplest component I could (no MVC):

defined('_JEXEC') or die('Restricted access');
$task = JRequest::getWord('task');
if ($task == "getCurrentTemp") {
 // return temperature
}

这可以被打印(定界符),以JS通过 JURI ::电流()的index.php选项= com_xzy和放大器;任务= getCurrentTemp。 不能够访问模块吸一点点,但我的理解认为,从建筑的角度。

This can be printed (heredoc) to JS by JURI::current()."index.php?option=com_xzy&task=getCurrentTemp". Not being able to access module sucks a little bit but I understand that from architectural point of view.

这篇关于如何使AJAX调用自己从的Joomla!模块?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆