Hi there.
I have a prototype class that has these two methods:
hide_precollapsed: function(){
if(this.get_state() != "visible"){
this.target.hide();
};
},
get_state: function(){
var state = "hidden";
new Ajax.Request(this.options.url, {
asynchronous:true,
method:'post',
parameters:'?do=get&id='+this.trigger.id,
onComplete: function(response){
state = response.responseText;
}
});
return state;
}
By logging the response from the requested url, and by alerting values
for debugging I have determines that the correct values are beeing
returned from the ajax request. And the targets and variables that is
reffered does exist.
My problem is that the +get_state+ method is not returning the
<tt>state</tt> correctly. It is simply not getting to the
+hide_precollapsed+ method. Well, that's not entirely true, if I add a
"alert('...')" to the +get_state+ method, just before the return, the
+hide_precollapsed+ will function properly.
get_state: function(){
var state = "hidden";
new Ajax.Request(this.options.url, {
asynchronous:true,
method:'post',
parameters:'?do=get&id='+this.trigger.id,
onComplete: function(response){
state = response.responseText;
}
});
alert('...');
return state;
}
To me this makes no sense at all! Why is it that I need to alert
something to the user in order to get the state to return correctly.
Am I doing something wrong?
Best regards
Emil
--
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.