YouTip LogoYouTip

Event Pageload

# jQuery Mobile pageload Event [![Image 4: jQuery Mobile Events](#) jQuery Mobile Events](#) ## Example Alert a message after an external page is successfully loaded and inserted into the DOM: ```javascript $(document).on("pageload",function(){ alert("pageload event triggered!"); }); [Try it Β»](#) * * * ## Definition and Usage Deprecated since version 1.4.0. Use (#) instead. The pageload event is triggered after a page is successfully loaded and inserted into the DOM. **Related Events:** - Event triggered before any loading occurs - Event triggered after a page fails to load. **Note:** When an external page is loaded into the DOM, two types of events will definitely be triggered. The pagebeforeload event before loading, and the pageload (load successful) or pageloadfailed (load failed) event after loading. * * * ## Syntax ```javascript $("document").on("pageload",function(event,data){...}) | Parameter | Description | | --- | --- | | function(event,data) | The function to execute after the pageload event is triggered. This function contains the following two parameters:
**Event Object** - Includes any jQuery event properties (event.target, event.type, etc.). For more information, please refer to the (#).
**Data Object** - Contains the following types:
* **url** (string) - The absolute or relative address passed to $.mobile.loadPage() via the callback.
* **absUrl** (string) - Contains the absolute reference of the URL.
* **dataUrl** (string) - Contains the browser's URL location.
* **options** (object) - Contains the optional parameters sent to $.mobile.loadPage().
* **xhr** (object) - Contains the XMLHttpRequest object (sent as the third parameter to the $.ajax() success callback).
* **textStatus** (string or null) - Contains the request status ("success" or "null") (sent as the second parameter to the $.ajax() failure callback). | * * * ![Image 5: Example](#) ## More Examples [Demonstration of related events.](#) Demonstration of pageload and pageloadfailed events. (#) Use the event.type property to return the type of event triggered. (#) Use data.url to return the URL of the external page. * * jQuery Mobile Events](#)
← Event PageloadfailedEvent Pageinit β†’