How do I get the value of a dynamic variable from PHP in js correctly?
-
Good day.
Please tell me how to get and add (glue) a dynamic value from PHP to js.
<a href="javascript:createMyPDF('.$BC.')"><button type="button" class="btn btn-primary">Create PDF</button></a>
$ BC is a counter from 1 to N.
js itself into which you need to transfer this value and glue it with the ID #edit_print _ ***:
function createMyPDF(**$BC**) { var dd = { content: [ { style: 'tableExample', color: '#444', table: { widths: [120,'*', '*', '*'], heights: [120,60,60,60,60,60,60,60,60,60,60], body: [ [ {text: 'value:',style: 'table_other', alignment: 'center'}, {text: $("#edit_print_ + **$BC** #pdf-out-6").val(),style: 'table_other', alignment: 'center'}, ], ] } }, ], styles: { header: { fontSize: 18, bold: true, margin: [0, 0, 0, 10] }, subheader: { fontSize: 16, bold: true, margin: [0, 10, 0, 5] }, table_header: { fontSize: 10, margin: [0, 50, 0, 0] }, table_other: { fontSize: 10, margin: [0, 25, 0, 0] }, tableHeader: { bold: true, fontSize: 13, color: 'black' } }, defaultStyle: { alignment: 'justify' } } pdfMake.createPdf(dd).open(); }
JavaScript Anonymous, Feb 16, 2019
0 Answers
Your Answer
To place the code, please use CodePen or similar tool. Thanks you!