show a particular div until content is loaded into another div from xml file in phonegap webservice

Posted by Balu on Stack Overflow See other posts from Stack Overflow or by Balu
Published on 2012-12-11T05:00:03Z Indexed on 2012/12/11 5:03 UTC
Read the original article Hit count: 173

Filed under:
|
|

I am doing a webservice in phonegap.Here the application fetch values from a xml file in remote server when user search particular keyword and load the content to a div in my application.Here my problem is I want to show toast message like "loading..." or "progressing..." till the content is loaded into the div of application.I have created a toast message.But I dont know how to hide the toast message after the content is loaded since the time for fetching values from xml file is different for different keywords. The div to which content is loaded is <ul class="searchresults"></ul>.and my toast function is

function toast(sMessage){
        var container = $(document.createElement("div"));
        container.addClass("loading");

        var message = $(document.createElement("div"));
        message.addClass("message");
        message.text(sMessage);
        message.appendTo(container);

        container.appendTo(document.body);

        container.delay(150).fadeIn("slow", function()
        {
               if ($(".searchresults").html().length > 0) {
                //$(this).remove();
                $(this).delay(500).fadeOut("slow", function()
                {
                $(this).remove();
                });
                }

        });
}

Can anyone help me suggesting some ideas.Thanks in advance.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery