# How to setup your Javascript/JQuery code with AJAX mode enabled

**URL:** <https://discuss.workflowgen.com/t/how-to-setup-your-javascript-jquery-code-with-ajax-mode-enabled/817>\
**Category:** Form Designer\
**Created:** [July 10, 2017, 7:15pm UTC](https://discuss.workflowgen.com/t/how-to-setup-your-javascript-jquery-code-with-ajax-mode-enabled/817 "2017-07-10T19:15:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![eddy.daouk](https://yyz2.discourse-cdn.com/flex030/user_avatar/discuss.workflowgen.com/eddy.daouk/32/672_2.png) [@eddy.daouk](https://discuss.workflowgen.com/u/eddy.daouk)\
**Post date:** [July 10, 2017, 7:15pm UTC](https://discuss.workflowgen.com/t/how-to-setup-your-javascript-jquery-code-with-ajax-mode-enabled/817/1 "2017-07-10T19:15:53Z")

</div>

**Details:**  
AJAX type web forms perform partial page updates made by an UpdatePanel on the page.  
Code like `$(document).ready(function(){});` will only be executed once after the page Document Object Model (DOM) is ready for JavaScript code to execute.

**Solution:**  
If you want to execute JavaScript code after each partial update, use the MSAjax **pageLoad** Event in your Javascript code:

```auto
        <script>

           // To ensure JavaScript is executed in runtime mode only.
            if (typeof $selectedObject === "undefined") 
            { 
               ///<summary>
               /// This will fire on initial page load, 
               /// and all subsequent partial page updates made 
               /// by any update panel on the page
               ///</summary>
                function pageLoad(){ alert('page loaded!')}
            }
        </script>

```
