最新动态新闻

让你轻松掌握天铭网络的第一手信息

烟台网站建设技术问答之mvc4 Jquery 页面打印

mvc4 Jquery 页面打印

2017/03/31

<script src="~/Scripts/js/dist/jquery.jqprint-0.3.js"></script>

<script type="text/javascript">
    $(function () {
        
        function LoadPrintData()
        {
            $("#dttoexcel").show();
            $("#dttoexcel").jqprint();
            return false;
        }

        //页面打印功能
        $("#printBtn").click(function () {
            var Processid = $("#Process_PTR").children('option:selected').val();
            processName = $("#Process_PTR").children('option:selected').text();
            var begintime = $("#beginDate").val();
            var lasttime = $("#lastDate").val();
            $.ajax({
                type: "POST",
                url: '../Assay_BillMain/LoadAssayInfo',
                async: true,
                dataType: "text",
                error: function (request) {
                    alert("请先查出数据");
                },
                beforeSend: function () {
                    $("#dttoexcel").hide();
                    $("#exportBtn").attr({ "disabled": "disabled" });
                    $("#printBtn").attr({ "disabled": "disabled" });
                },
                success: function (data) {
                    $("#dttoexcel").show();
                    $("#dttoexcel").html(data);
                    LoadPrintData(data);
                    $("#dttoexcel").hide();
                    $("#exportBtn").removeAttr("disabled");//将按钮可用
                    $("#printBtn").removeAttr("disabled");//将按钮可用
                }
            });
            //防止Ajax页面提交后被刷新
            return false;
        });
    });

</script>

 

<button id="printBtn" role="button" class="btn btn-info btn-small">
      <i class="icon-print icon-white"></i> 打印
</button>


0
分享到: