Hello,

 

I’m looking for some help – I’m having problems in getting the loading message to disappear – sometimes it disappears, sometimes it doesn’t.

 

This is the _javascript_ I have:

 

            ajaxContent: function(iTabPos) {

                        if (isNaN(iTabPos)) return false;

                        var iTabIndex = this._posToIndex(iTabPos);

                        var oTab              = this.tabs[iTabIndex];

                        var oPanel    = oTab.panel;

                        //if (str && str.length > 0) oTab.panel.innerHTML = str;

                       

                        var rand  = parseInt(Math.random()*99999999); // chache buster

                        var url   = 'content.php';

                        var param = 'iTabPos=' + iTabPos +                                                        

                                                            '&rand='   + rand;

                        var loading = $('loading');                        

                        var ajax = new Ajax.Updater(oPanel, url, {

                                    method: 'get',

                                    evalScripts: true,

                                    parameters: param,

                                    asynchronous: true,

                                    onLoading: function(request) {                                        

                                                Element.show(loading)

                                    }.bind(this),                                                                                           

                                    onComplete: function(request) {

                                                Element.hide(loading);

                                                this.show(iTabPos);

                                    }.bind(this),

                                    onFailure: function(request) {

                                               

                                    }.bind(this)

                        })

            }

 

And this is the PHP

 

            $iTabPos = (isset($_REQUEST['iTabPos']) ? $_REQUEST['iTabPos'] : '');

           

            switch ($iTabPos) {

            case 1:

               echo "This is the external AJAX content for panel 1";

               break;

            case 2:

               echo "This is the external AJAX content for panel 2";

               break;

            default:

               echo "panel not found";

            }

 

What is it that I’m doing wrong – thank you in advance for your help.

 

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

Reply via email to