javascript - Jquery Function to display Loading icon on whole page -
i have price calculation function calculate price on loading 5 seconds displays price of products.the image path in loadingimg variable. want call on page shows loading image on page after 5 seconds when time finishes displays results usual. please me. thank you
function calculateprice() { var req, parameters, datasend, prodlist; loading = setinterval(function () { $('.objprice', prodlist).html(loadingimg); }, 5); var querystring = "?" + basic_para + "&" + getpricecalculationquerystring() + "&filter=" + filter + "&sort=1&filterchange=0&cacheprod=0"; if (page_type < 3) { querystring = querystring + "&dumy=1", datasend = ""; } else { req = { refid: refidlist }; datasend = json.stringify(req); datasend = encodeuricomponent(datasend); } url_querystring = querystring; updatelabels(); searchcontrol(2); if (isrefid == "" && landwithprice == false) { smoothscroll('prodlistinsp', 300); } parameters = "prodrq=" + datasend; if (document.domain.indexof("localhost") != -1 || document.domain.indexof("tenbook") != -1) { makerequest(tenweb_path + "/inspiration/pricecalculatorpage.aspx" + querystring, parameters); } else { makerequest("http://" + document.domain + "/" + proxypage + querystring, parameters); } }
avoid setinterval
this. display loadingimg
when function called, , put settimeout
inside it.
when you're done doing calculations, timeout display result.
Comments
Post a Comment