Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery Mobile “Error Loading Page”

I am using Jquery1.8.2 and Jquery-mobile 1.1

When i click on Logout button i have to goto the Home page. I am able get the home page but before going back to the home page got the "Error Loading Page" message.

Test.html

<body>  
  <div data-role="page">
      <div data-role="header" data-theme="b" >
          <h1> Success Page </h1>
           <a data-role="button" id="logoutbtn" data-theme="b">Logout</a>
       </div><!-- /header -->
       <div data-role='content'>            
    </div>
</div>
</body>

test.js

$(document).ready(function(){   
$("#logoutbtn").click(function () {     
    document.location.href = "Home.html";
});
});

Please help me out on this.

like image 564
Srikanth Chilukuri Avatar asked Oct 16 '12 08:10

Srikanth Chilukuri


4 Answers

You should be using the jquery mobile specific methods.

$.mobile.changePage("Home.html");

See document-location-href-location-vs-mobile-changepagelocation

like image 155
andleer Avatar answered Nov 20 '22 22:11

andleer


Thanks Dipaks

Instead of

document.location.href = "/Home.html";

I have modified it as like below

document.location.href = "./Home.html";

Its working fine and able to go back to home page with out any error.

like image 3
Srikanth Chilukuri Avatar answered Nov 20 '22 22:11

Srikanth Chilukuri


$.mobile.changePage("Home.html") did not work on my PC

but instead $.mobile.changePage("#"); works and it's hiding the error loading page message.

like image 1
user2114127 Avatar answered Nov 20 '22 20:11

user2114127


I was using the right versions and $.mobile.changePage to change a page and it still failed with the same error. Later I realized that I was doing this in a js file in www/js/custom/handler/handler.js. So I was using paths relative to this location.

However later I realized that the path has to be relative to index.html that includes this js.

That resolved my issue.

like image 1
Asif Avatar answered Nov 20 '22 21:11

Asif