views:

102

answers:

1

wow! i just noticed something, every time i try to call a function, no matter what function, in javascript, somehow jquery and ms ajax framework javascript captures it and checks if the document is ready (document.onready or other) and never returns the control back to the function im calling, or whatever it does, my function never ends up getting called! why on earth is it doing this? i've never asked for it to!!!

all i have is references to these libraries, script/link references as you do on the top of your master page.

thsi is ridiculous, anyone have any ideas?

here is the code breaks when calling UpdateGlobalVariables

<script src="../../Scripts/MicrosoftAjax.debug.js" type="text/javascript"></script>
<script src="../../Scripts/MicrosoftAjax.js" type="text/javascript"></script>
<script src="../../Scripts/MicrosoftMvcAjax.debug.js" type="text/javascript"></script>
<script src="../../Scripts/MicrosoftMvcAjax.js" type="text/javascript"></script>
<script src="../../Scripts/jquery-1.3.2.js" type="text/javascript"></script>
<script src="../../Scripts/jquery.superload.js" type="text/javascript"></script>
<script src="~/Views/Shared/JScript.js" type="text/javascript"></script>

<script type="text/javascript" language="javascript">
        var RatePicPanelRunCount = 0;

        function ChangeMainPic(newSrc) {
        $get("imgPic").src = newSrc;
        alert($get("imgPic").src + '\n' + newSrc);
        RatePicPanelRunCount++;
        }


        function UpdateGlobalVariables() {
        // Update variables...
        ShownPicID = <%=Model.CurShownPicID%>;
        ShownUserID = <%= Model.CurShownUserID %>;
            CurrentUserID = <%= UserID %>;
            alert('CurUserID is ' + CurrentUserID);
            alert('From cookie its ' + getCookie('UserID'));
        }

        debugger;

    if (RatePicPanelRunCount == 0) {
            ChangeMainPic('<%= Model.CurPicURL%>');
            UpdateGlobalVariables;
    };

</script>
+1  A: 

At the very bottom of your script, shouldn't you be calling UpdateGlobalVariables();, not UpdateGlobalVariables;?

Seth Petry-Johnson
you were right, i put the () and it worked, control didnt go to the document.onready anymore - thanks.
Erx_VB.NExT.Coder