How to prevent a DOM show using jQuery

How to prevent a DOM show using jQuery



down vote
favorite
Is there any methods to prevent a DOM in jQM show until data is ready loaded? I have two pages, need to get data from JSON and i don't want to show them when data haven't ready loaded into them. And here is what i did but it not work. I have two page #palvelu and #varaus in index.html file.


 var varausJarru = $.Deferred();
    var palveluJarru = $.Deferred();
$( document ).on("pagecreate", "#varaus", function () {
        getJson();
        varausJarru;
    });
    $( document ).on("pagecreate", "#palvelu", function () {
        getPalveluJson();
        palveluJarru;
    });
    $( document ).on("pageshow", "#palvelu", function () {
    });
   $( document ).on("pageshow", "#varaus", function () {
    });