Thanks T.J.

I probably should have been more specific.

I'm actually building a Q and A Captcha, not a Logger. I used that as
an example.

The issue is, I am using proto's Ajax.Request and I'm running that
code within the 'onComplete: function(transport){ callback }' and this
is executing within a method which get an array of questions from a
Another method then creates a select list and renders it to the page.

I have found that if I declare a var using the 'this.arrayName' before
running the Ajax.Request I can load the array OK.

What is strange, is that I can then do 'this.ArrayName  = var;' and
populate the objects array whilst I'm still in the  'onComplete

Why is it that I cant load the this,arrayName as shown, but it lets be
're-value it'??

Here is a sample of the code: some var declarations are Not show for

var qArr = this.cap_questions; // I CREATE THE USABLE VAR WORKAROUND
HERE ????
var url = "path-to-php-script-&sid="+Math.random();
var req = new Ajax.Request( url, {      // I USE THE var = req TO MAKE
        method: 'get', contentType: 'application/xml', onComplete: function
(transport) {
                res = transport.responseXML; cap_nodes = 
                for(i=0; i < cap_nodes.length; i++){
                this.cap_questions = qArr; // HERE IT LETS ME RE-DECLARE THIS

If I try to declare the VAR within the callback it won't work either,
Has to be before the new Ajax.Request.
I checked with 'typeof' and it returns 'undefined'....

I have another problem as well.

How can I call a method within another method, like in PHP.

Using 'this.methodName()" does not seem to work.
After completion of one methods db retrieval, I do a check for state,
and would like to call a method within the working method.
The idea worked (as functions) before I re-wrote the whole idea into
a  single class.
I want the class to be as dynamic as possible, and dont want to have
to add more intelect to the pages code.
This will be a publicly available App, so I'm trying to make it as
simple as possible to setup.

Thanks again for the Quick HELP. Its much appreciated!
Cheers, Gilbert R..
You received this message because you are subscribed to the Google Groups 
"Prototype &" group.
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at

Reply via email to