jQuery Mobile pageloadEvent

jQuery Mobile 事件jQuery Mobile Events

Examples

Pop up a message after the external page is successfully loaded and inserted into the DOM:

$(document).on("pageload",function(){
alert("pageload event triggered!");
});

Try it Yourself »

Definition and Usage

Deprecated after version 1.4.0, usepagecontainerloadinstead.

The pageload event is triggered after the page is successfully loaded and inserted into the DOM.

Related events:

Note:When an external page is loaded into the DOM, two types of events are definitely triggered: the pagebeforeload event before loading, and the pageload (successful load) or pageloadfailed (failed load) event after loading.


Syntax

$("document").on("pageload",function(event,data){...})

Parameters Description
function(event,data) The function specified 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, seejQuery Event Reference Manual

Data object- Contains the following types:

  • url(string) - The absolute or relative URL passed to $.mobile.loadPage() via the callback
  • absUrl(string) - The absolute reference containing 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)


实例

More Examples

Demonstration of related events.
Demonstration of the pageload and pageloadfailed events.

Event object
Use the event.type property to return the type of event triggered.

Data object
Use data.url to return the URL of the external page.


jQuery Mobile 事件jQuery Mobile Events

Other Extensions