I am trying to print js variable but it shows only String
success: function(data) 
            {
               var temp = $(".acname").text(data.accName[0].user_full_name); 
            },
         buttons: [
                    {
                extend: 'print',footer: 'true',className: "btn btn-primary",
                customize: function ( win ) {
                $(win.document.body)
                  .css( 'font-size', '10pt' )
                  .prepend(
                '<h2 align="center"><font color="#5CAAFF">Barque Trans And Logistics P.V.T.L.T.D</font></h2>'+
                 '<h3 align="center"><font color="#5CAAFF">Safeguarding Valuables</font></h3>'+
                  '<hr style="height: 1px;">'+
                  '<h5 align="center"><strong>REPORT FOR LEDGER </strong></h5>'+
              //on this line I am trying to use variable    
          '<h5 align="center"> <?php echo $temp ?> </h5>'
                       );
In my var temp variable it gives me name and want that name on
  `'<h5 align="center"> <?php echo $temp ?> </h5>'`
 
     
    
' + temp + '
'`. You just need to make sure `temp` is declared within scope of both locations where it's used – Rory McCrossan Jun 21 '19 at 12:40' + temp + '
'` code but it gives me `object object` output – farhantechno Jun 21 '19 at 12:53'+ "" +'
'` – farhantechno Jun 21 '19 at 13:03