4

I've spent 5 hours just trying to make the loading message show up using jQuery Mobile. Instead, I'm getting:

Uncaught TypeError: Object #<Object> has no method 'loading'

Here is my code:

<script src="http://code.jquery.com/jquery-1.7.1.min.js"></script> <script src="http://code.jquery.com/mobile/1.1.1/jquery.mobile-1.1.1.min.js"></script> <script type="text/javascript"> $.mobile.loading("show"); </script> 

Here is the current code:

 <head> <title>My Page</title> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="http://code.jquery.com/mobile/1.1.1/jquery.mobile-1.1.1.min.css" /> <script src="http://code.jquery.com/jquery-1.7.1.min.js"></script> <script src="http://code.jquery.com/mobile/1.1.1/jquery.mobile-1.1.1.min.js"></script> <script type="text/javascript"> $.mobile.showPageLoadingMsg(); </script> </head> 

3 Answers 3

2

The exception you're encountering is due to an inaccurate method reference, as stated in the error:

Uncaught TypeError: Object # has no method 'loading'

The loading() method was added in 1.2, but you're using 1.1.1, which is why it states it does not have a loading method.

Show or hide the page loading message, which is configurable via $.mobile.loader prototype options as described in the widget docs or can be controlled via a params object.

Usage:

//cue the page loader $.mobile.loading( 'show' ); //use theme swatch "b", a custom message, and no spinner $.mobile.loading( 'show', { theme: "b", text: "foo", textonly: true }); 

The method that you should be using for your version is showPageLoadingMsg().

Usage:

//cue the page loader $.mobile.loadingMessage = 'Loading...Please wait'; $.mobile.showPageLoadingMsg(); //use theme swatch "b", a custom message, and no spinner $.mobile.showPageLoadingMsg("b", "This is only a test", true); 
Sign up to request clarification or add additional context in comments.

4 Comments

Where i can found the 1.2 version ?
It appears as though they have not released version 1.2 yet. jquerymobile.com/blog/2012/01/10/…
So can i have just a sample work fine with the $.mobile.showPageLoadingMsg() Please? because i put it and no loading msg show up and no error apper.
You have to set the loadingMessage value first.
0

You use jquery.mobile-1.1.1.min.js . jQuery mobile 1.1.1 is not supported

$.mobile.loading("show"); 

and this method is in jQuery mobile 1.2.0.

It is supported

$.mobile.showPageLoadingMsg(); 

And you can configure loadMessage in mobileinit method.

EX:

 $.mobile.loadingMessage = "Loading Message"; $.mobile.loadingMessageTextVisible = true; $.mobile.loadingMessageTheme="a"; 

I had same issue and finally i found it.

Comments

-1

Finally i found the solution

it's can't be called directly from a simple javascript function, i need to use it with a page

$("#Step1").live("pageshow", function () { $.mobile.showPageLoadingMsg(); }); 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.