{"id":94,"date":"2023-08-25T17:32:41","date_gmt":"2023-08-25T17:32:41","guid":{"rendered":"\/\/api.jquerymobile.com\/1.3\/?p=94"},"modified":"2023-08-25T17:32:41","modified_gmt":"2023-08-25T17:32:41","slug":"pageloadfailed","status":"publish","type":"post","link":"https:\/\/api.jquerymobile.com\/1.3\/pageloadfailed\/","title":{"rendered":"pageloadfailed"},"content":{"rendered":"<article id=\"pageloadfailed1\" class=\"entry event\"><h2 class=\"section-title\">\n<span>pageloadfailed event<\/span><span class=\"version-details\">version added: 1.0<\/span>\n<\/h2>\n<div class=\"entry-wrapper\">\n<p class=\"desc\"><strong>Description: <\/strong>Triggered if the page load request failed.<\/p>\n<ul class=\"signatures\"><li class=\"signature\"><h4 class=\"name\">jQuery( &quot;.selector&quot; ).on( &quot;pageloadfailed&quot;, function( event ) { ... } )<\/h4><\/li><\/ul>\n<div class=\"longdesc\" id=\"entry-longdesc\">\n\t\t<p>By default, after dispatching this event, the framework will display a page failed message and call reject() on the deferred object contained within the event&apos;s data object. Callbacks can prevent this default behavior from executing by calling <code>preventDefault()<\/code> on the event.<\/p>\n\t\t<p>The data object, passed as the 2nd arg to the callback function contains the following properties:<\/p>\n            <ul>\n            \t<li>\n<code>url<\/code> (string)\n\t\t\t\t\t<ul>\n           \t    \t\t<li>The absolute or relative URL that was passed into <code>$.mobile.loadPage()<\/code> by the caller.<\/li>\n          \t    \t<\/ul>\n            \t<\/li>\n            \t<li>\n<code>absUrl<\/code> (string)\n            \t\t<ul>\n            \t    \t<li>The absolute version of the url. If url was relative, it is resolved against the url used to load the current active page.<\/li>\n          \t    \t<\/ul>\n            \t<\/li>\n            \t<li>\n<code>dataUrl<\/code> (string)\n\t\t\t\t\t<ul>\n\t\t\t\t\t\t<li>The filtered version of absUrl to be used when identifying the page and updating the browser location when the page is made active.<\/li>\n\t\t\t\t\t<\/ul>\n\t\t\t\t<\/li>\n\t\t\t\t<li>\n<code>deferred<\/code> (object)\n            \t\t<ul>\n\t\t\t\t\t\t<li>Callbacks that call <code>preventDefault()<\/code> on the event, *MUST* call <code>resolve()<\/code> or <code>reject()<\/code> on this object so that <code>changePage()<\/code> requests resume processing. Deferred object observers expect the deferred object to be resolved like this:\n<div class=\"syntaxhighlighter javascript\">\n\t<table>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t\n\t\t\t\t<td class=\"gutter\">\n\t\t\t\t\t\n\t\t\t\t\t\t<div class=\"line n1\">1<\/div>\n\t\t\t\t\t\n\t\t\t\t\t\t<div class=\"line n2\">2<\/div>\n\t\t\t\t\t\n\t\t\t\t\t\t<div class=\"line n3\">3<\/div>\n\t\t\t\t\t\n\t\t\t\t\t\t<div class=\"line n4\">4<\/div>\n\t\t\t\t\t\n\t\t\t\t\t\t<div class=\"line n5\">5<\/div>\n\t\t\t\t\t\n\t\t\t\t\t\t<div class=\"line n6\">6<\/div>\n\t\t\t\t\t\n\t\t\t\t\t\t<div class=\"line n7\">7<\/div>\n\t\t\t\t\t\n\t\t\t\t\t\t<div class=\"line n8\">8<\/div>\n\t\t\t\t\t\n\t\t\t\t\t\t<div class=\"line n9\">9<\/div>\n\t\t\t\t\t\n\t\t\t\t\t\t<div class=\"line n10\">10<\/div>\n\t\t\t\t\t\n\t\t\t\t\t\t<div class=\"line n11\">11<\/div>\n\t\t\t\t\t\n\t\t\t\t\t\t<div class=\"line n12\">12<\/div>\n\t\t\t\t\t\n\t\t\t\t\t\t<div class=\"line n13\">13<\/div>\n\t\t\t\t\t\n\t\t\t\t\t\t<div class=\"line n14\">14<\/div>\n\t\t\t\t\t\n\t\t\t\t\t\t<div class=\"line n15\">15<\/div>\n\t\t\t\t\t\n\t\t\t\t<\/td>\n\t\t\t\t\n\t\t\t\t<td class=\"code\">\n\t\t\t\t\t<pre><div class=\"container\"><div class=\"line\"><code>$( <span class=\"hljs-built_in\">document<\/span> ).on( <span class=\"hljs-string\">&quot;pageloadfailed&quot;<\/span>, <span class=\"hljs-function\"><span class=\"hljs-keyword\">function<\/span>(<span class=\"hljs-params\"> event, data <\/span>) <\/span>{<\/code><\/div><\/div><div class=\"container\"><div class=\"line\"><code> <\/code><\/div><\/div><div class=\"container\"><div class=\"line\"><code>  <span class=\"hljs-comment\">\/\/ Let the framework know we&apos;re going to handle things.<\/span><\/code><\/div><\/div><div class=\"container\"><div class=\"line\"><code> <\/code><\/div><\/div><div class=\"container\"><div class=\"line\"><code>  event.preventDefault();<\/code><\/div><\/div><div class=\"container\"><div class=\"line\"><code> <\/code><\/div><\/div><div class=\"container\"><div class=\"line\"><code>  <span class=\"hljs-comment\">\/\/ ... attempt to load some other page ...<\/span><\/code><\/div><\/div><div class=\"container\"><div class=\"line\"><code>  <span class=\"hljs-comment\">\/\/ at some point, either in this callback, or through<\/span><\/code><\/div><\/div><div class=\"container\"><div class=\"line\"><code>  <span class=\"hljs-comment\">\/\/ some other async means, call resolve, passing in<\/span><\/code><\/div><\/div><div class=\"container\"><div class=\"line\"><code>  <span class=\"hljs-comment\">\/\/ the following args, plus a jQuery collection object<\/span><\/code><\/div><\/div><div class=\"container\"><div class=\"line\"><code>  <span class=\"hljs-comment\">\/\/ containing the DOM element for the page.<\/span><\/code><\/div><\/div><div class=\"container\"><div class=\"line\"><code> <\/code><\/div><\/div><div class=\"container\"><div class=\"line\"><code>  data.deferred.resolve( data.absUrl, data.options, page );<\/code><\/div><\/div><div class=\"container\"><div class=\"line\"><code> <\/code><\/div><\/div><div class=\"container\"><div class=\"line\"><code>});<\/code><\/div><\/div><\/pre>\n\t\t\t\t<\/td>\n\t\t\t<\/tr>\n\t\t<\/tbody>\n\t<\/table>\n<\/div>\n\n                    <p>or rejected like this:<\/p>\n<div class=\"syntaxhighlighter javascript\">\n\t<table>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t\n\t\t\t\t<td class=\"gutter\">\n\t\t\t\t\t\n\t\t\t\t\t\t<div class=\"line n1\">1<\/div>\n\t\t\t\t\t\n\t\t\t\t\t\t<div class=\"line n2\">2<\/div>\n\t\t\t\t\t\n\t\t\t\t\t\t<div class=\"line n3\">3<\/div>\n\t\t\t\t\t\n\t\t\t\t\t\t<div class=\"line n4\">4<\/div>\n\t\t\t\t\t\n\t\t\t\t\t\t<div class=\"line n5\">5<\/div>\n\t\t\t\t\t\n\t\t\t\t\t\t<div class=\"line n6\">6<\/div>\n\t\t\t\t\t\n\t\t\t\t\t\t<div class=\"line n7\">7<\/div>\n\t\t\t\t\t\n\t\t\t\t\t\t<div class=\"line n8\">8<\/div>\n\t\t\t\t\t\n\t\t\t\t\t\t<div class=\"line n9\">9<\/div>\n\t\t\t\t\t\n\t\t\t\t\t\t<div class=\"line n10\">10<\/div>\n\t\t\t\t\t\n\t\t\t\t\t\t<div class=\"line n11\">11<\/div>\n\t\t\t\t\t\n\t\t\t\t\t\t<div class=\"line n12\">12<\/div>\n\t\t\t\t\t\n\t\t\t\t\t\t<div class=\"line n13\">13<\/div>\n\t\t\t\t\t\n\t\t\t\t\t\t<div class=\"line n14\">14<\/div>\n\t\t\t\t\t\n\t\t\t\t<\/td>\n\t\t\t\t\n\t\t\t\t<td class=\"code\">\n\t\t\t\t\t<pre><div class=\"container\"><div class=\"line\"><code>$( <span class=\"hljs-built_in\">document<\/span> ).on( <span class=\"hljs-string\">&quot;pageloadfailed&quot;<\/span>, <span class=\"hljs-function\"><span class=\"hljs-keyword\">function<\/span>(<span class=\"hljs-params\"> event, data <\/span>) <\/span>{<\/code><\/div><\/div><div class=\"container\"><div class=\"line\"><code> <\/code><\/div><\/div><div class=\"container\"><div class=\"line\"><code>  <span class=\"hljs-comment\">\/\/ Let the framework know we&apos;re going to handle things.<\/span><\/code><\/div><\/div><div class=\"container\"><div class=\"line\"><code> <\/code><\/div><\/div><div class=\"container\"><div class=\"line\"><code>  event.preventDefault();<\/code><\/div><\/div><div class=\"container\"><div class=\"line\"><code> <\/code><\/div><\/div><div class=\"container\"><div class=\"line\"><code>  <span class=\"hljs-comment\">\/\/ ... attempt to load some other page ...<\/span><\/code><\/div><\/div><div class=\"container\"><div class=\"line\"><code>  <span class=\"hljs-comment\">\/\/ at some point, if the load fails, either in this<\/span><\/code><\/div><\/div><div class=\"container\"><div class=\"line\"><code>  <span class=\"hljs-comment\">\/\/ callback, or through some other async means, call<\/span><\/code><\/div><\/div><div class=\"container\"><div class=\"line\"><code>  <span class=\"hljs-comment\">\/\/ reject like this:<\/span><\/code><\/div><\/div><div class=\"container\"><div class=\"line\"><code> <\/code><\/div><\/div><div class=\"container\"><div class=\"line\"><code>  data.deferred.reject( data.absUrl, data.options );<\/code><\/div><\/div><div class=\"container\"><div class=\"line\"><code> <\/code><\/div><\/div><div class=\"container\"><div class=\"line\"><code>});<\/code><\/div><\/div><\/pre>\n\t\t\t\t<\/td>\n\t\t\t<\/tr>\n\t\t<\/tbody>\n\t<\/table>\n<\/div>\n\n\t\t\t\t\t\t<\/li>\n\t\t\t\t\t<\/ul>\n            \t<\/li>\n            \t<li>\n<code>options<\/code> (object)\n            \t\t<ul>\n            \t\t\t<li>This object contains the options that were passed into <code>$.mobile.loadPage()<\/code>.<\/li>\n          \t    \t<\/ul>\n            \t<\/li>\n            \t<li>\n<code>xhr<\/code> (object)\n            \t\t<ul>\n            \t\t\t<li>The jQuery XMLHttpRequest object used when attempting to load the page. This is what gets passed as the first argument to the framework&apos;s <code>$.ajax()<\/code> error callback.<\/li>\n          \t    \t<\/ul>\n            \t<\/li>\n            \t<li>\n<code>textStatus<\/code> (null or string)\n            \t\t<ul>\n            \t\t\t<li>According to the jQuery Core <a href=\"\/\/api.jquery.com\/jQuery.ajax\/\">documentation<\/a>, possible values for this property, aside from null, are &quot;timeout&quot;, &quot;error&quot;, &quot;abort&quot;, and &quot;parsererror&quot;. This is what gets passed as the 2nd argument to the framework&apos;s <code>$.ajax()<\/code> error callback.<\/li>\n          \t    \t<\/ul>\n            \t<\/li>\n            \t<li>\n<code>errorThrown<\/code> (null, string, object)\n            \t\t<ul>\n            \t\t\t<li>According to the jQuery Core <a href=\"\/\/api.jquery.com\/jQuery.ajax\/\">documentation<\/a>, this property may be an exception object if one occurred, or if an HTTP error occurred this will be set to the textual portion of the HTTP status. This is what gets passed as the 3rd argument to the framework&apos;s <code>$.ajax()<\/code> error callback.<\/li>\n          \t    \t<\/ul>\n            \t<\/li>\n           \t <\/ul>\n\t<\/div>\n<\/div><\/article>","protected":false},"excerpt":{"rendered":"<p>Triggered if the page load request failed.<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-94","post","type-post","status-publish","format-standard","hentry","category-events"],"_links":{"self":[{"href":"https:\/\/api.jquerymobile.com\/1.3\/wp-json\/wp\/v2\/posts\/94","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/api.jquerymobile.com\/1.3\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/api.jquerymobile.com\/1.3\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/api.jquerymobile.com\/1.3\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/api.jquerymobile.com\/1.3\/wp-json\/wp\/v2\/comments?post=94"}],"version-history":[{"count":1,"href":"https:\/\/api.jquerymobile.com\/1.3\/wp-json\/wp\/v2\/posts\/94\/revisions"}],"predecessor-version":[{"id":95,"href":"https:\/\/api.jquerymobile.com\/1.3\/wp-json\/wp\/v2\/posts\/94\/revisions\/95"}],"wp:attachment":[{"href":"https:\/\/api.jquerymobile.com\/1.3\/wp-json\/wp\/v2\/media?parent=94"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/api.jquerymobile.com\/1.3\/wp-json\/wp\/v2\/categories?post=94"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/api.jquerymobile.com\/1.3\/wp-json\/wp\/v2\/tags?post=94"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}