jQuery Mobile pageload
Event
Example
Display a message after an external page has been successfully loaded and inserted into the DOM:
$(document).on("pageload", function(){ alert("pageload event triggered!"); });
Definition and Usage
The pageload
event is triggered after a page has been successfully loaded and inserted into the DOM.
Related Events:
- pagebeforeload - Triggered before any load.
- pageloadfailed - Triggered after a page load fails.
Note: When an external page is loaded into the DOM, two types of events are definitely triggered. The pagebeforeload
event before loading, and either pageload
(on successful load) or pageloadfailed
(on load failure).
Syntax
Parameter | Description |
---|---|
function(event, data) | The function to execute when the pageload event is triggered. The function has the following two parameters: Event object - Includes any jQuery event properties (event.target, event.type, etc.). For more information, see the jQuery Event Reference. 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 options 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). |