I think I may be missing a fundamental concept I hope someone can help me with. I have functions that won't call other functions. Particularly after an Ajax request.

In the following object the ajax request onComplete calls the ajaxFetched function successfully. ajaxFetched tries to call function2 but function2 does not execute.

Any ideas or workarounds?

thanks
Kevin


o = Class.create();
o.prototype = {
        initialize: function() {
                this.fetchAjaxData();
        },
        
        fetchAjaxData: function(){
                url="ajax/minimap.php";
                pars="x=1&y=1";
                
                var myAjax= new Ajax.Request(
                        url,
                        {
                                method: 'get',
                                parameters: pars,
                                onComplete: this.ajaxFetched
                        });
        },
        
        ajaxFetched: function(){
                alert('ajaxFetched called');
                this.function2();
        },
        
        function2: function(){
                alert('function2 called');
        }
}

Event.observe(window, 'load', function(){var O = new o();});

_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs

Reply via email to