<script src= "~/scripts/js/dist/jquery.jqprint-0.3.js" ></script>
<script type= "Text/javascript" >
$ (function () {
function Loadprintdata ()
{
$ ("#dttoexcel"). Show ();
$ ("#dttoexcel"). Jqprint ();
return false;
}
//Page printing function
$ ("#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 ("Please identify the data first");
},
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");//The button is available
$ ("#printBtn"). Removeattr ("Disabled");//The button is available
}
});
//Prevent Ajax page from being refreshed after submission
return false;
});
});
</script>
<button id= "printbtn" role= "button" class= "btn btn-info btn-small" >
<i class= "Icon-print icon-white" ></i> printing
</button>
MVC4 Jquery Page Print