$.loading = function (show, content) { var _loadingToast = '<div id="loadingToast">' + '<div class="weui-mask_transparent"></div>' + '<div class="weui-toast">' + '<i class="weui-loading weui-icon_toast"></i>' + '<p id="loadingToast_content" class="weui-toast__content"></p>' + '</div>' + '</div>'; if (show) { $(document.body).append(_loadingToast); if (!!content) { $("#loadingToast_content").html(content); } else { $("#loadingToast_content").html("數據加載中"); } } else { $("#loadingToast").remove(); } }