var ajaxbg = $("#background,#progressBar"); ajaxbg.hide(); $(document).ajaxStart(function () { ajaxbg.show(); }).ajaxStop(function () { ajaxbg.hide(); });var ajaxbg = $("#background,#progressBar",parent.document); ajaxbg.hide(); $(parent.document).ajaxStart(function () { ajaxbg.show(); }).ajaxStop(function () { ajaxbg.hide(); });