Reputation: 13
I'm working on a component for Joomla 1.7, and Joomla 1.7 works with Mootools 1.3. Before that, the correct way in mootools was Ajax class. But in Mootools, as I read, I must use Request class.
Ok, when I try to use the Request class and take a look with Google Inspector debuging step by step the Request definition and Request send() call. I can see that, it execs the send but it does nothing (ignores onSuccess, ignores OnException, etc).
And if I look on chrome javascript console there's nothing.
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();
}
Upvotes: 0
Views: 410
Reputation: 26165
the api has changed from 1.1x to 1.2 -> Request now takes a single argument object that overloads all options you need, INCLUDING url - which used to be arguments[0] before.
In other words - move the url from there into a property of the options object:
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();
Upvotes: 1