Hi,
I have a function :
request:function (object) {
var chaine = "var param = {";
for (var i = 0; i < object.param.length; i++) {
chaine = chaine + "param_" + i + ":" + object.param[i] + ","
}
chaine = chaine.substr(0, (chaine.length - 1));
chaine = chaine + "};";
eval(chaine);
new Ajax.Request(object.php, {
method:object.method,
encoding:'UTF-8',
contentType:'application/x-www-form-urlencoded',
parameters:param,
onsucess:function (xhr, json) {
if (json[0].etat === "A") {
result.etat = 'A';
result.message = json[0].msg;
/* test 2 */ return {result:result};
alert('ok');
}
else if (json[0].etat === "S") {
result.etat = 'S';
result.message = json[0].msg;
}
}
},
onException:function (xhr, e) {
alert('Exception : ' + e);
}});
alert(result.etat);
return {result:result};
}
first test : if I test, everything works, I have "alert(ok)", but
"alert(result.etat)" is empty.
second test : with test 2 active, return doesn't work.
I think that Ajax.Request doesn't exchange the parameters between
ajax.request and my request function.
But I don't know how to link them ?
Best regards.
--
You received this message because you are subscribed to the Google Groups
"Prototype & script.aculo.us" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/prototype-scriptaculous?hl=en.