//Data loa...">

Html generates data and prints from another page

In the code below

in a.html there is this code like,

         <div id="tableview"></div>//Data loaded dynamically

         <input type="button" id="printbtn" onclick="print()"/>             
         <script>
         function print()
         {
            var data=$('#tableview').html();
            dataobj.print();
          }

In b.html

I need to print a.html without opening it, but not opening it, how the data will be generated in the div, and how to print only this data from b.html

Thank..

+3
source share
3 answers

Update: this answer assumes that after your question there should not be a postback. (No ajax)

If you have only one view per page, you can apply the media = print filter to the page. First load both views and show the on-screen window.

<Style href="print.css" media="print" />

prinatble:

 * {
    visibility: hidden;
  }

  #tableview * {
    visibility: visible;
  }
+3
  • Ajax b.htm

  • div.

  • div a.htm

  • , , div.

0

I think you can make ajax request on b.html to get the content and then print it.

function contentprint()
{
$.ajax({
           url : "b.html",
           success : function (data) {
           var data1=data;
           data1.print();
}
});
}

NTN

0
source

Source: https://habr.com/ru/post/1739865/


All Articles