jatan vyas

jatan vyas

  • 1.6k
  • 95
  • 2.3k

Document.ready method is called after pageload method.

Jun 6 2018 1:18 AM
Hello Guys
 
I am facing one strange issue. I am upgrading my project to latest jquery version 3.3.2
 
I have create one sample page which contains only update panel and a javascript link.
 
Now problem is instead of calling documet.ready mehtod, when i refresh the page (run the application) , pageLoad method called first and than documet.ready method gets called.
 
I have tried using older version of jqury 2.2.4 and up to that it was working fine with update panel, but when i upgraded to latest version 3.x.x it creates an issue. Below is sample code
 
default.aspx page
  1. <head runat="server">  
  2. <script type="text/javascript" src="https://code.jquery.com/jquery-3.0.0.js"></script>  
  3. <%--<script type="text/javascript" src="https://code.jquery.com/jquery-2.2.4.js"></script>--%>  
  4. <script src="Scripts/JavaScript.js"></script>  
  5. <title></title>  
  6. </head>  
  7. <body>  
  8. <form id="form1" runat="server">  
  9. <div> Page body  
  10. </div>  
  11. <asp:ScriptManager runat="server" ID="sm" ScriptMode="Debug" EnableCdn="false"  
  12. EnablePartialRendering="true" LoadScriptsBeforeUI="true">  
  13. <CompositeScript>  
  14. <Scripts>  
  15. <asp:ScriptReference Name="MicrosoftAjax.js" />  
  16. <asp:ScriptReference Name="MicrosoftAjaxWebForms.js" />  
  17. </Scripts>  
  18. </CompositeScript>  
  19. </asp:ScriptManager>  
  20. <asp:UpdatePanel runat="server" ID="upSnapshot" UpdateMode="Conditional">  
  21. <ContentTemplate>  
  22. Update panel body  
  23. </ContentTemplate>  
  24. </asp:UpdatePanel>  
  25. </form>  
  26. </body>  
Javascript
  1. $j = jQuery.noConflict();  
  2. $j(document).ready(function () {  
  3. alert('document.ready');  
  4. });  
  5. function pageLoad(sender, args) {  
  6. alert('Pageload');  
  7. }  

Answers (1)