我正在构建一个 Joomla 扩展,并尝试使用 MooTools 将一些数据发送到 php 脚本,以保存在数据库中。
这是请求的代码:
myReq: new Request({
url: '/index.php?option=com_calculator&task=saveData',
method: 'post',
onSuccess: function (responseText, responseXML) {
console.log(reponseText);
}
})
当我运行它时,Firebug 抛出此错误:
Permission denied for <http://localhost> to get property XMLHttpRequest.channel
我已经阅读了周围的内容,认为它可能与 Ajax 的相同域策略有关,但我无法修复它。
最佳答案
试试这个:
var requestHTMLData = new Request.HTML ({
url: 'index.php?option=com_calculator&task=saveData',
update: $('contains')
}).send();
$('contains')
是您想要响应的 div id。
有关更多信息,请参阅 Gantry Framework
关于php - Joomla + Mootools XMLHttpRequest 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2288279/