2018-08-30html
直接调用浏览器的打印方法ajax
一、打印按钮浏览器
<a href="#" target="_self" onclick="printme()">打印</a>
二、jspost
//打印 function printme() { $.messager.confirm('确认', '确认打印?', function (r) { if (r) { document.body.innerHTML = document.getElementById('div1').innerHTML + '<br/>'; window.print(); var OrderGUID = $("#OrderGUID").val(); window.location.href = "../Details/?id=" + OrderGUID + "&Check=0"; //打印记录 $.ajax({ type: "post", anysc: false, url: '@Url.Action("AddPrintLog")', data: { OrderGUID: OrderGUID }, success: function (da) { if (da > 0) { //alert(da.split('|')[0]); $.messager.alert('提示!', '成功!'); //location.reload(); window.location.href = "../Details/?id=" + OrderGUID + "&Check=0"; } else if (da = -1) { $.messager.alert('提示!', '添加操做记录错误!'); return false; } }, }); } }); }
四、结果url