Javascript 为什么来自Mootools的新请求类什么都不做。。。还是不理我?
我正在为Joomla 1.7开发一个组件,Joomla 1.7与Mootools 1.3配合使用。在此之前,mootools中的正确方法是Ajax类。但在Mootools中,正如我所读到的,我必须使用请求类 好的,当我尝试使用Request类并查看Google Inspector一步一步地调试Request定义和Request send()调用时。我可以看到,它执行发送,但不执行任何操作(忽略onSuccess、忽略OnException等) 如果我看一下chrome javascript控制台,什么都没有Javascript 为什么来自Mootools的新请求类什么都不做。。。还是不理我?,javascript,joomla,mootools,Javascript,Joomla,Mootools,我正在为Joomla 1.7开发一个组件,Joomla 1.7与Mootools 1.3配合使用。在此之前,mootools中的正确方法是Ajax类。但在Mootools中,正如我所读到的,我必须使用请求类 好的,当我尝试使用Request类并查看Google Inspector一步一步地调试Request定义和Request send()调用时。我可以看到,它执行发送,但不执行任何操作(忽略onSuccess、忽略OnException等) 如果我看一下chrome javascript控制台
function addValue(value) {
var id = $('selectedval').getProperty('value');
var url = 'index.php?option=com_kaltura&controller=fieldsmanager&task=additem&tmpl=component';
var req = new Request(url, {
method: 'post',
data: {
'id': id,
'value': value
},
onRequest: function(event, xhr) {alert('gogogo'); },
onFailure: function(xhr) { alert('failure'.xhr); },
onException: function(test) {alert(test); },
onSuccess: function(data) {
loadFieldList(data);
}
});
req.send();
}
api已从1.1x更改为1.2->Request现在接受一个参数对象,该对象重载您所需的所有选项,包括url-以前是参数[0] 换句话说,将url从此处移动到options对象的属性中:
new Request({
url: url,
method: 'post',
data: {
'id': id,
'value': value
},
onRequest: function(event, xhr) {alert('gogogo'); },
onFailure: function(xhr) { alert('failure'.xhr); },
onException: function(test) {alert(test); },
onSuccess: function(data) {
loadFieldList(data);
}
}).send();