views:

468

answers:

1

Hello!

I have a strange problem. I have a jQuery document.ready function executing some script on the page. When I was testing it through opening the file with firefox/opera it worked. When I uploaded it to the server (I tried both my home apache and my shared hosting) it only works once in 10 loads maybe.

What could be the problem?

Thanks beforehand

Edit:

Here is the code. It configures the correct size of side panels according to central panel.

    <script type="text/javascript">
   $(document).ready(function(){
     // Get natural heights
     var cHeight = $("#content").height(); 
     var nHeight = $("#left").height() - $("#footer").height() - $("#header").height() - 10; 

    // Assign maximum height to all columns
    $("#leftcontent").height(nHeight);
    $("#rightcontent").height(nHeight);
     $("#left").height(cHeight);
    $("#right").height(cHeight);
    });   
 </script>
+1  A: 

Check that you have no JS syntax errors first (firebug or simply the error console).

If not have you considered just putting a simple alert in the ready function. If that still fails you know its something to do with the JQuery library itself (unlikely).

If you consistently get alerts you know its a problem with your own code. Further help with that will require sight of your code.

AnthonyWJones
Firebug reports no problems in code, but on server code just does not execute - if I set a breakpoint it never fires. It DOES fire when I do it outside the server. I'll post the code in second comment.
freiksenet
I don't under stand "on server code", what does that mean.
AnthonyWJones
Did you do the simple alert test, does that work?
AnthonyWJones
I mean that it works when I just move to the folder and open with mozzila. When I put it into www folder of Apache server and open it through localhost - it stops working.
freiksenet
Anyhow - it works pretty stable after I moved css links above js links in <head>. I have no idea why it works now :(
freiksenet