[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Corrupted Get request

Posted on 2007-10-06
4
Medium Priority
?
173 Views
Last Modified: 2013-12-08
Hi

Got a bit of an urgent issue here.

My site isn't loading at all in IE7.  I'm getting an Error 400, bad request.  The microsoft help page says it's a corrupted get request.  Presumably because of the method in the function below which is calling prototype.js (http://www.prototypejs.org/).  It works fine in IE6 and Firefox though.  Confused.

I tried method post instead and that's not allowed on the server.  Is it a simple matter for the server administrator to sort this out?  Or will I need to change the code?

Thanks

function  populateBox (serverPage, obj){
      var objID = "iboxtext";
      new Ajax.Updater(objID, serverPage, {method:'get', onComplete:function(){
                        //change tab color
                        if(obj != null){
                              var links = $('infoboxtabs').getElementsByTagName('A');
                              for (var i=0; i<links.length; i++) {
                                    links[i].className = 'plain';  
                              }
                              obj.className = 'highlighted';
                        }
                       
                  }
            }
      );
     
      return false;
}
//load initial page.
Event.observe(window, 'load', function(){ populateBox('page.html', null); });
0
Comment
Question by:Lady_M
  • 3
4 Comments
 
LVL 63

Accepted Solution

by:
Zvonko earned 2000 total points
ID: 20028846
Simplify this first:
//load initial page.
Event.observe(window, 'load', function(){ populateBox('page.html', null); });

To this:
window.onload= function(){populateBox('page.html', null)};



0
 
LVL 63

Assisted Solution

by:Zvonko
Zvonko earned 2000 total points
ID: 20028866
And you have a semantic problem in your function populateBox()
You cannot use the parameter obj in the anonymous function() assigned to the onComplete property. The parameter obj is visible ONLY inside the function populateBox(). At end of populateBox() does obj discard and the anonymous function() cannot see it.

What you can do is this:

var theObj=null;
function  populateBox (serverPage, obj){
      theObj = obj;
      var objID = "iboxtext";
      new Ajax.Updater(objID, serverPage, {method:'get', onComplete:function(){
                        //change tab color
                        if(theObj != null){
                              var links = $('infoboxtabs').getElementsByTagName('A');
                              for (var i=0; i<links.length; i++) {
                                    links[i].className = 'plain';  
                              }
                              theObj.className = 'highlighted';
                        }
                  }
            }
      );
      return false;
}

// sidenote: only the last call wins and last theObj is highlighted, but that should be ok.



0
 

Author Comment

by:Lady_M
ID: 20029513
Thankyou, it works.  That's a big relief!  Thought it was going to be a day of agonising.
I'm not very sure what you meant by your explanation, if you get time could you try explaining it again in words of one syllable please?
Thanks
PS, I can't use the window.onload because IE refuses to do it.
0
 
LVL 63

Assisted Solution

by:Zvonko
Zvonko earned 2000 total points
ID: 20029542
There can be only one onload statement. The last assignment wins. So if you have in the body tag also an onload="" assignment, then it will win, or when you have anywhere on the page a second onload then does that onload overwrite all previous onload assignments.

The last side note does say this in plain English: the event onComplete is fired outside of the scope of the function populateBox(), so all local visible variables of the function populateBox() are not visible outside the function. All variables in a function defined with a var prefix are of scope local, also all passed variables in the function parameter braces are local variables to the function. To be able to get the variable in another function you need a global variable. The global variable is defined by defining a var outside of any function body, then is the var global and can be used from anywhere on the page.
Is that description readable to you?

0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The first step to building an amazing About page is to figure out what you want the page to say about your company. You then must grab the attention of the reader, boast a bit, tell a story and let others brag about you. With a little bit of thought…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…
Suggested Courses
Course of the Month19 days, 1 hour left to enroll

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question