{"id":3534,"date":"2018-10-09T05:27:04","date_gmt":"2018-10-09T05:27:04","guid":{"rendered":"https:\/\/www.codexworld.com\/?p=3534"},"modified":"2018-10-09T05:30:04","modified_gmt":"2018-10-09T05:30:04","slug":"print-dynamic-content-using-javascript-jquery-php-mysql","status":"publish","type":"post","link":"https:\/\/www.codexworld.com\/print-dynamic-content-using-javascript-jquery-php-mysql\/","title":{"rendered":"Print Dynamic Content using JavaScript, jQuery, and PHP"},"content":{"rendered":"<p>The print is a very useful feature for any data management section. Generally, the print option is used in the web application to save data for offline use. There are various plugins available to print web page content using jQuery. Alternatively, you can print the web page content using <b>window print() method<\/b> in JavaScript. In this case, the static data or div content of the current window is printed.<\/p>\n<p>You can easily <a href=\"https:\/\/www.codexworld.com\/print-page-area-javascript\/\">print the content of a specific div using JavaScript<\/a>. But, some cases you need to allow the user to <b>print dynamic content<\/b> from the database without previewing in the web page. To integrate this functionality, the dynamic content needs to be loaded from the server-side and print dynamic div content on the fly. In this tutorial, we will show you how to load dynamic content in the hidden div and <b>print the content of hidden div<\/b> using JavaScript, jQuery, Ajax, PHP, and MySQL.<\/p>\n<p>To demonstrate the dynamic div content print functionality, the following steps will be implemented.<\/p>\n<ul class=\"bullet_disk_list\">\n<li>Display dropdown element to select a specific user.<\/li>\n<li>Load the selected user&#8217;s details from the database.<\/li>\n<li>Print dynamic user data on the fly without preview on the web page.<\/li>\n<\/ul>\n<h2>Create Database Table<\/h2>\n<p>To store user&#8217;s information a table need to be created in the database. The following SQL creates a <code>users<\/code> table with some basic fields in the MySQL database.<\/p>\n<pre><span style=\"color: rgb(149, 65, 33);\">CREATE<\/span> <span style=\"color: rgb(149, 65, 33);\">TABLE<\/span> <span style=\"color: rgb(33, 145, 97);\">`users`<\/span> (\r\n <span style=\"color: rgb(33, 145, 97);\">`id`<\/span> <span style=\"color: rgb(0, 134, 179);\">int<\/span>(<span style=\"color: rgb(64, 160, 112);\">11<\/span>) <span style=\"color: rgb(149, 65, 33);\">NOT<\/span> <span style=\"color: rgb(149, 65, 33);\">NULL<\/span> AUTO_INCREMENT,\r\n <span style=\"color: rgb(33, 145, 97);\">`name`<\/span> <span style=\"color: rgb(0, 134, 179);\">varchar<\/span>(<span style=\"color: rgb(64, 160, 112);\">50<\/span>) <span style=\"color: rgb(149, 65, 33);\">COLLATE<\/span> utf8_unicode_ci <span style=\"color: rgb(149, 65, 33);\">NOT<\/span> <span style=\"color: rgb(149, 65, 33);\">NULL<\/span>,\r\n <span style=\"color: rgb(33, 145, 97);\">`email`<\/span> <span style=\"color: rgb(0, 134, 179);\">varchar<\/span>(<span style=\"color: rgb(64, 160, 112);\">50<\/span>) <span style=\"color: rgb(149, 65, 33);\">COLLATE<\/span> utf8_unicode_ci <span style=\"color: rgb(149, 65, 33);\">NOT<\/span> <span style=\"color: rgb(149, 65, 33);\">NULL<\/span>,\r\n <span style=\"color: rgb(33, 145, 97);\">`phone`<\/span> <span style=\"color: rgb(0, 134, 179);\">varchar<\/span>(<span style=\"color: rgb(64, 160, 112);\">15<\/span>) <span style=\"color: rgb(149, 65, 33);\">COLLATE<\/span> utf8_unicode_ci <span style=\"color: rgb(149, 65, 33);\">NOT<\/span> <span style=\"color: rgb(149, 65, 33);\">NULL<\/span>,\r\n <span style=\"color: rgb(33, 145, 97);\">`created`<\/span> datetime <span style=\"color: rgb(149, 65, 33);\">NOT<\/span> <span style=\"color: rgb(149, 65, 33);\">NULL<\/span>,\r\n <span style=\"color: rgb(33, 145, 97);\">`modified`<\/span> datetime <span style=\"color: rgb(149, 65, 33);\">NOT<\/span> <span style=\"color: rgb(149, 65, 33);\">NULL<\/span>,\r\n <span style=\"color: rgb(33, 145, 97);\">`status`<\/span> enum(<span style=\"color: rgb(33, 145, 97);\">'Active'<\/span>,<span style=\"color: rgb(33, 145, 97);\">'Inactive'<\/span>) <span style=\"color: rgb(149, 65, 33);\">COLLATE<\/span> utf8_unicode_ci <span style=\"color: rgb(149, 65, 33);\">NOT<\/span> <span style=\"color: rgb(149, 65, 33);\">NULL<\/span> <span style=\"color: rgb(149, 65, 33);\">DEFAULT<\/span> <span style=\"color: rgb(33, 145, 97);\">'Active'<\/span>,\r\n PRIMARY <span style=\"color: rgb(149, 65, 33);\">KEY<\/span> (<span style=\"color: rgb(33, 145, 97);\">`id`<\/span>)\r\n) <span style=\"color: rgb(149, 65, 33);\">ENGINE<\/span>=<span style=\"color: rgb(149, 65, 33);\">InnoDB<\/span> <span style=\"color: rgb(149, 65, 33);\">DEFAULT<\/span> <span style=\"color: rgb(149, 65, 33);\">CHARSET<\/span>=utf8 <span style=\"color: rgb(149, 65, 33);\">COLLATE<\/span>=utf8_unicode_ci;<\/pre>\n<h2>Database Configuration (dbConfig.php)<\/h2>\n<p>The <code>dbConfig.php<\/code> file is used to connect and select the database. Specify the database host (<code>$dbHost<\/code>), username (<code>$dbUsername<\/code>), password (<code>$dbPassword<\/code>), and name (<code>$dbName<\/code>) as per your MySQL database credentials.<\/p>\n<pre><span style=\"color: #0000BB\">&lt;?php<br \/><\/span><span style=\"color: #FF8000\">\/\/&nbsp;Database&nbsp;configuration<br \/><\/span><span style=\"color: #0000BB\">$dbHost&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #DD0000\">\"localhost\"<\/span><span style=\"color: #007700\">;<br \/><\/span><span style=\"color: #0000BB\">$dbUsername&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #DD0000\">\"root\"<\/span><span style=\"color: #007700\">;<br \/><\/span><span style=\"color: #0000BB\">$dbPassword&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #DD0000\">\"root\"<\/span><span style=\"color: #007700\">;<br \/><\/span><span style=\"color: #0000BB\">$dbName&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #DD0000\">\"codexworld\"<\/span><span style=\"color: #007700\">;<br \/><br \/><\/span><span style=\"color: #FF8000\">\/\/&nbsp;Create&nbsp;database&nbsp;connection<br \/><\/span><span style=\"color: #0000BB\">$db&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;new&nbsp;<\/span><span style=\"color: #0000BB\">mysqli<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #0000BB\">$dbHost<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #0000BB\">$dbUsername<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #0000BB\">$dbPassword<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #0000BB\">$dbName<\/span><span style=\"color: #007700\">);<br \/><br \/><\/span><span style=\"color: #FF8000\">\/\/&nbsp;Check&nbsp;connection<br \/><\/span><span style=\"color: #007700\">if&nbsp;(<\/span><span style=\"color: #0000BB\">$db<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">connect_error<\/span><span style=\"color: #007700\">)&nbsp;{<br \/>&nbsp;&nbsp;&nbsp;&nbsp;die(<\/span><span style=\"color: #DD0000\">\"Connection&nbsp;failed:&nbsp;\"&nbsp;<\/span><span style=\"color: #007700\">.&nbsp;<\/span><span style=\"color: #0000BB\">$db<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">connect_error<\/span><span style=\"color: #007700\">);<br \/>}<\/span><\/pre>\n<h2>Print Dynamic Content (index.php)<\/h2>\n<p><b>HTML &#038; PHP:<\/b><br \/>\nInitially, all the users are fetched from the database and listed in the dropdown. A specific user needs to be selected to print the details information of the user from the database.<\/p>\n<ul class=\"bullet_disk_list\">\n<li>Dropdown &#8211; Helps to list and select the user.<\/li>\n<li>Print button &#8211; Initialize the print.<\/li>\n<li>Hidden div &#8211; Holds the dynamically generated content that retrieved from the database. <\/li>\n<\/ul>\n<pre><span style=\"color: #0000BB\">&lt;?php<br \/><\/span><span style=\"color: #FF8000\">\/\/&nbsp;Include&nbsp;the&nbsp;database&nbsp;configuration&nbsp;file<br \/><\/span><span style=\"color: #007700\">require_once&nbsp;<\/span><span style=\"color: #DD0000\">'dbConfig.php'<\/span><span style=\"color: #007700\">;<br \/><br \/><\/span><span style=\"color: #FF8000\">\/\/&nbsp;Fetch&nbsp;the&nbsp;users&nbsp;from&nbsp;the&nbsp;database<br \/><\/span><span style=\"color: #0000BB\">$result&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #0000BB\">$db<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">query<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #DD0000\">\"SELECT&nbsp;id,&nbsp;name&nbsp;FROM&nbsp;users\"<\/span><span style=\"color: #007700\">);<br \/><\/span><span style=\"color: #0000BB\">?&gt;<\/span>\r\n\r\n<span style=\"color: rgb(108, 107, 90);\">&lt;!-- Dropdown to select the user --&gt;<\/span>\r\n<span style=\"color: rgb(186, 98, 54);\">&lt;<span style=\"color: rgb(186, 98, 54);\">select<\/span> <span>id<\/span>=<span style=\"color: rgb(125, 151, 38);\">\"userSelect\"<\/span>&gt;<\/span>\r\n    <span style=\"color: rgb(186, 98, 54);\">&lt;<span style=\"color: rgb(186, 98, 54);\">option<\/span> <span>value<\/span>=<span style=\"color: rgb(125, 151, 38);\">\"\"<\/span>&gt;<\/span>Select User<span style=\"color: rgb(186, 98, 54);\">&lt;\/<span style=\"color: rgb(186, 98, 54);\">option<\/span>&gt;<\/span>\r\n    <span style=\"color: #0000BB\">&lt;?php&nbsp;<\/span><span style=\"color: #007700\">while(<\/span><span style=\"color: #0000BB\">$row&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #0000BB\">$result<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">fetch_assoc<\/span><span style=\"color: #007700\">()){&nbsp;<\/span><span style=\"color: #0000BB\">?&gt;<\/span>\r\n    <span style=\"color: rgb(186, 98, 54);\">&lt;<span style=\"color: rgb(186, 98, 54);\">option<\/span> <span>value<\/span>=<span style=\"color: rgb(125, 151, 38);\">\"<span style=\"color: #0000BB\">&lt;?php&nbsp;<\/span><span style=\"color: #007700\">echo&nbsp;<\/span><span style=\"color: #0000BB\">$row<\/span><span style=\"color: #007700\">[<\/span><span style=\"color: #DD0000\">'id'<\/span><span style=\"color: #007700\">];&nbsp;<\/span><span style=\"color: #0000BB\">?&gt;<\/span>\"<\/span>&gt;<\/span><span style=\"color: #0000BB\">&lt;?php&nbsp;<\/span><span style=\"color: #007700\">echo&nbsp;<\/span><span style=\"color: #0000BB\">$row<\/span><span style=\"color: #007700\">[<\/span><span style=\"color: #DD0000\">'name'<\/span><span style=\"color: #007700\">];&nbsp;<\/span><span style=\"color: #0000BB\">?&gt;<\/span><span style=\"color: rgb(186, 98, 54);\">&lt;\/<span style=\"color: rgb(186, 98, 54);\">option<\/span>&gt;<\/span>\r\n    <span style=\"color: #0000BB\">&lt;?php&nbsp;<\/span><span style=\"color: #007700\">}&nbsp;<\/span><span style=\"color: #0000BB\">?&gt;<\/span>\r\n<span style=\"color: rgb(186, 98, 54);\">&lt;\/<span style=\"color: rgb(186, 98, 54);\">select<\/span>&gt;<\/span>\r\n\r\n<span style=\"color: rgb(108, 107, 90);\">&lt;!-- Print button --&gt;<\/span>\r\n<span style=\"color: rgb(186, 98, 54);\">&lt;<span style=\"color: rgb(186, 98, 54);\">button<\/span> <span>id<\/span>=<span style=\"color: rgb(125, 151, 38);\">\"getUser\"<\/span>&gt;<\/span>Print Details<span style=\"color: rgb(186, 98, 54);\">&lt;\/<span style=\"color: rgb(186, 98, 54);\">button<\/span>&gt;<\/span>\r\n\r\n<span style=\"color: rgb(108, 107, 90);\">&lt;!-- Hidden div to load the dynamic content --&gt;<\/span>\r\n<span style=\"color: rgb(186, 98, 54);\">&lt;<span style=\"color: rgb(186, 98, 54);\">div<\/span> <span>id<\/span>=<span style=\"color: rgb(125, 151, 38);\">\"userInfo\"<\/span> <span>style<\/span>=<span style=\"color: rgb(125, 151, 38);\">\"display: none;\"<\/span>&gt;<\/span><span style=\"color: rgb(186, 98, 54);\">&lt;\/<span style=\"color: rgb(186, 98, 54);\">div<\/span>&gt;<\/span>\r\n<\/pre>\n<p><b>JavaScript:<\/b><br \/>\nInclude the jQuery library.<\/p>\n<pre><span style=\"color: rgb(186, 98, 54);\">&lt;<span style=\"color: rgb(186, 98, 54);\">script<\/span> <span>src<\/span>=<span style=\"color: rgb(125, 151, 38);\">\"https:\/\/ajax.googleapis.com\/ajax\/libs\/jquery\/3.3.1\/jquery.min.js\"<\/span>&gt;<\/span><span style=\"color: rgb(186, 98, 54);\">&lt;\/<span style=\"color: rgb(186, 98, 54);\">script<\/span>&gt;<\/span><\/pre>\n<p>The following code loads the dynamic content from the server-side and prints specific div content with window print() method.<\/p>\n<ul class=\"bullet_disk_list\">\n<li>Get the selected user ID.<\/li>\n<li>Load data from the server-side script (<code>getData.php<\/code>) and puts dynamic content in the specific element using <b>jQuery load() method<\/b>.<\/li>\n<li>Open the Print Dialog to let the user print the dynamic content of the specific hidden div using <b>window print() method<\/b>.<\/li>\n<\/ul>\n<pre><span style=\"color: rgb(186, 98, 54);\">&lt;<span style=\"color: rgb(186, 98, 54);\">script<\/span>&gt;<\/span>\r\n$(<span style=\"color: rgb(182, 86, 17);\">document<\/span>).ready(<span><span style=\"color: rgb(184, 84, 212);\">function<\/span>(<span style=\"color: rgb(182, 86, 17);\"><\/span>)<\/span>{\r\n    $(<span style=\"color: rgb(96, 172, 57);\">'#getUser'<\/span>).on(<span style=\"color: rgb(96, 172, 57);\">'click'<\/span>,<span><span style=\"color: rgb(184, 84, 212);\">function<\/span>(<span style=\"color: rgb(182, 86, 17);\"><\/span>)<\/span>{\r\n        <span style=\"color: rgb(184, 84, 212);\">var<\/span> userID = $(<span style=\"color: rgb(96, 172, 57);\">'#userSelect'<\/span>).val();\r\n        $(<span style=\"color: rgb(96, 172, 57);\">'#userInfo'<\/span>).load(<span style=\"color: rgb(96, 172, 57);\">'getData.php?id='<\/span>+userID,<span><span style=\"color: rgb(184, 84, 212);\">function<\/span>(<span style=\"color: rgb(182, 86, 17);\"><\/span>)<\/span>{\r\n            <span style=\"color: rgb(184, 84, 212);\">var<\/span> printContent = <span style=\"color: rgb(182, 86, 17);\">document<\/span>.getElementById(<span style=\"color: rgb(96, 172, 57);\">'userInfo'<\/span>);\r\n            <span style=\"color: rgb(184, 84, 212);\">var<\/span> WinPrint = <span style=\"color: rgb(182, 86, 17);\">window<\/span>.open(<span style=\"color: rgb(96, 172, 57);\">''<\/span>, <span style=\"color: rgb(96, 172, 57);\">''<\/span>, <span style=\"color: rgb(96, 172, 57);\">'width=900,height=650'<\/span>);\r\n            WinPrint.document.write(printContent.innerHTML);\r\n            WinPrint.document.close();\r\n            WinPrint.focus();\r\n            WinPrint.print();\r\n            WinPrint.close();\r\n        });\r\n    });\r\n});\r\n<span style=\"color: rgb(186, 98, 54);\">&lt;\/<span style=\"color: rgb(186, 98, 54);\">script<\/span>&gt;<\/span><\/pre>\n<h2>Load Dynamic Data (getData.php)<\/h2>\n<p>The <code>getData.php<\/code> file is loaded by the <b>AJAX load() method<\/b> to retrieve the user data from the database using PHP and MySQL.<\/p>\n<ul class=\"bullet_disk_list\">\n<li>The specific user&#8217;s ID is retrieved from the query string of the URL.<\/li>\n<li>The data is fetched from the users table based on the specific ID.<\/li>\n<li>The user details are rendered and dynamic content is returned to the <code>load()<\/code> method.<\/li>\n<\/ul>\n<pre><span style=\"color: #0000BB\">&lt;?php<br \/>$userData&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;array();<br \/>if(!empty(<\/span><span style=\"color: #0000BB\">$_GET<\/span><span style=\"color: #007700\">[<\/span><span style=\"color: #DD0000\">'id'<\/span><span style=\"color: #007700\">])){<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #FF8000\">\/\/&nbsp;Include&nbsp;the&nbsp;database&nbsp;configuration&nbsp;file<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #007700\">require_once&nbsp;<\/span><span style=\"color: #DD0000\">'dbConfig.php'<\/span><span style=\"color: #007700\">;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #FF8000\">\/\/&nbsp;Get&nbsp;the&nbsp;user's&nbsp;ID&nbsp;from&nbsp;the&nbsp;URL<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$userID&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #0000BB\">$_GET<\/span><span style=\"color: #007700\">[<\/span><span style=\"color: #DD0000\">'id'<\/span><span style=\"color: #007700\">];<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #FF8000\">\/\/&nbsp;Fetch&nbsp;the&nbsp;user&nbsp;data&nbsp;based&nbsp;on&nbsp;the&nbsp;ID<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$query&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #0000BB\">$db<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">query<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #DD0000\">\"SELECT&nbsp;*&nbsp;FROM&nbsp;users&nbsp;WHERE&nbsp;id&nbsp;=&nbsp;\"<\/span><span style=\"color: #007700\">.<\/span><span style=\"color: #0000BB\">$userID<\/span><span style=\"color: #007700\">);<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;if(<\/span><span style=\"color: #0000BB\">$query<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">num_rows&nbsp;<\/span><span style=\"color: #007700\">&gt;&nbsp;<\/span><span style=\"color: #0000BB\">0<\/span><span style=\"color: #007700\">){<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$userData&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #0000BB\">$query<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">fetch_assoc<\/span><span style=\"color: #007700\">();<br \/>&nbsp;&nbsp;&nbsp;&nbsp;}<br \/>}<br \/><\/span><span style=\"color: #0000BB\">?&gt;<\/span>\r\n\r\n<span style=\"color: rgb(108, 107, 90);\">&lt;!-- Render the user details --&gt;<\/span>\r\n<span style=\"color: rgb(186, 98, 54);\">&lt;<span style=\"color: rgb(186, 98, 54);\">div<\/span> <span>class<\/span>=<span style=\"color: rgb(125, 151, 38);\">\"container\"<\/span>&gt;<\/span>\r\n    <span style=\"color: rgb(186, 98, 54);\">&lt;<span style=\"color: rgb(186, 98, 54);\">h2<\/span>&gt;<\/span>User Details<span style=\"color: rgb(186, 98, 54);\">&lt;\/<span style=\"color: rgb(186, 98, 54);\">h2<\/span>&gt;<\/span>\r\n    <span style=\"color: #0000BB\">&lt;?php&nbsp;<\/span><span style=\"color: #007700\">if(!empty(<\/span><span style=\"color: #0000BB\">$userData<\/span><span style=\"color: #007700\">)){&nbsp;<\/span><span style=\"color: #0000BB\">?&gt;<\/span>\r\n        <span style=\"color: rgb(186, 98, 54);\">&lt;<span style=\"color: rgb(186, 98, 54);\">p<\/span>&gt;<\/span><span style=\"color: rgb(186, 98, 54);\">&lt;<span style=\"color: rgb(186, 98, 54);\">b<\/span>&gt;<\/span>Name:<span style=\"color: rgb(186, 98, 54);\">&lt;\/<span style=\"color: rgb(186, 98, 54);\">b<\/span>&gt;<\/span> <span style=\"color: #0000BB\">&lt;?php&nbsp;<\/span><span style=\"color: #007700\">echo&nbsp;<\/span><span style=\"color: #0000BB\">$userData<\/span><span style=\"color: #007700\">[<\/span><span style=\"color: #DD0000\">'name'<\/span><span style=\"color: #007700\">];&nbsp;<\/span><span style=\"color: #0000BB\">?&gt;<\/span><span style=\"color: rgb(186, 98, 54);\">&lt;\/<span style=\"color: rgb(186, 98, 54);\">p<\/span>&gt;<\/span>\r\n        <span style=\"color: rgb(186, 98, 54);\">&lt;<span style=\"color: rgb(186, 98, 54);\">p<\/span>&gt;<\/span><span style=\"color: rgb(186, 98, 54);\">&lt;<span style=\"color: rgb(186, 98, 54);\">b<\/span>&gt;<\/span>Email:<span style=\"color: rgb(186, 98, 54);\">&lt;\/<span style=\"color: rgb(186, 98, 54);\">b<\/span>&gt;<\/span> <span style=\"color: #0000BB\">&lt;?php&nbsp;<\/span><span style=\"color: #007700\">echo&nbsp;<\/span><span style=\"color: #0000BB\">$userData<\/span><span style=\"color: #007700\">[<\/span><span style=\"color: #DD0000\">'email'<\/span><span style=\"color: #007700\">];&nbsp;<\/span><span style=\"color: #0000BB\">?&gt;<\/span><span style=\"color: rgb(186, 98, 54);\">&lt;\/<span style=\"color: rgb(186, 98, 54);\">p<\/span>&gt;<\/span>\r\n        <span style=\"color: rgb(186, 98, 54);\">&lt;<span style=\"color: rgb(186, 98, 54);\">p<\/span>&gt;<\/span><span style=\"color: rgb(186, 98, 54);\">&lt;<span style=\"color: rgb(186, 98, 54);\">b<\/span>&gt;<\/span>Phone:<span style=\"color: rgb(186, 98, 54);\">&lt;\/<span style=\"color: rgb(186, 98, 54);\">b<\/span>&gt;<\/span> <span style=\"color: #0000BB\">&lt;?php&nbsp;<\/span><span style=\"color: #007700\">echo&nbsp;<\/span><span style=\"color: #0000BB\">$userData<\/span><span style=\"color: #007700\">[<\/span><span style=\"color: #DD0000\">'phone'<\/span><span style=\"color: #007700\">];&nbsp;<\/span><span style=\"color: #0000BB\">?&gt;<\/span><span style=\"color: rgb(186, 98, 54);\">&lt;\/<span style=\"color: rgb(186, 98, 54);\">p<\/span>&gt;<\/span>\r\n        <span style=\"color: rgb(186, 98, 54);\">&lt;<span style=\"color: rgb(186, 98, 54);\">p<\/span>&gt;<\/span><span style=\"color: rgb(186, 98, 54);\">&lt;<span style=\"color: rgb(186, 98, 54);\">b<\/span>&gt;<\/span>Created:<span style=\"color: rgb(186, 98, 54);\">&lt;\/<span style=\"color: rgb(186, 98, 54);\">b<\/span>&gt;<\/span> <span style=\"color: #0000BB\">&lt;?php&nbsp;<\/span><span style=\"color: #007700\">echo&nbsp;<\/span><span style=\"color: #0000BB\">$userData<\/span><span style=\"color: #007700\">[<\/span><span style=\"color: #DD0000\">'created'<\/span><span style=\"color: #007700\">];&nbsp;<\/span><span style=\"color: #0000BB\">?&gt;<\/span><span style=\"color: rgb(186, 98, 54);\">&lt;\/<span style=\"color: rgb(186, 98, 54);\">p<\/span>&gt;<\/span>\r\n        <span style=\"color: rgb(186, 98, 54);\">&lt;<span style=\"color: rgb(186, 98, 54);\">p<\/span>&gt;<\/span><span style=\"color: rgb(186, 98, 54);\">&lt;<span style=\"color: rgb(186, 98, 54);\">b<\/span>&gt;<\/span>Status:<span style=\"color: rgb(186, 98, 54);\">&lt;\/<span style=\"color: rgb(186, 98, 54);\">b<\/span>&gt;<\/span> <span style=\"color: #0000BB\">&lt;?php&nbsp;<\/span><span style=\"color: #007700\">echo&nbsp;<\/span><span style=\"color: #0000BB\">$userData<\/span><span style=\"color: #007700\">[<\/span><span style=\"color: #DD0000\">'status'<\/span><span style=\"color: #007700\">];&nbsp;<\/span><span style=\"color: #0000BB\">?&gt;<\/span><span style=\"color: rgb(186, 98, 54);\">&lt;\/<span style=\"color: rgb(186, 98, 54);\">p<\/span>&gt;<\/span>\r\n    <span style=\"color: #0000BB\">&lt;?php&nbsp;<\/span><span style=\"color: #007700\">}else{&nbsp;<\/span><span style=\"color: #0000BB\">?&gt;<\/span>\r\n        <span style=\"color: rgb(186, 98, 54);\">&lt;<span style=\"color: rgb(186, 98, 54);\">p<\/span>&gt;<\/span>User not found...<span style=\"color: rgb(186, 98, 54);\">&lt;\/<span style=\"color: rgb(186, 98, 54);\">p<\/span>&gt;<\/span>\r\n    <span style=\"color: #0000BB\">&lt;?php&nbsp;<\/span><span style=\"color: #007700\">}&nbsp;<\/span><span style=\"color: #0000BB\">?&gt;<\/span>\r\n<span style=\"color: rgb(186, 98, 54);\">&lt;\/<span style=\"color: rgb(186, 98, 54);\">div<\/span>&gt;<\/span><\/pre>\n<p class=\"seeAlso\"><span><\/span><a href=\"https:\/\/www.codexworld.com\/print-specific-area-of-web-page-using-jquery\/\">Print a Specific Area of the Web Page using jQuery<\/a><\/span><\/p>\n<h2>Conclusion<\/h2>\n<p>Most cases, the print option is used to print the content that already displayed on the web page. For this common purpose, you can use window print() method to allow the user to select preferred printing options. You can also let the user print the specific div content or content of the specific element. The example code provided here is useful when you want to <b>print dynamic data from the database<\/b> on the fly without a preview on the web page. Also, it will provide a solution to <b>print the content of a hidden div using JavaScript<\/b>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The print is a very useful feature for any data management section. Generally, the print option is used in the web application to save data for offline use. There are various plugins available to print <\/p>\n","protected":false},"author":1,"featured_media":3536,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[10],"tags":[66,16,14,174],"class_list":["post-3534","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-javascript","tag-javascript","tag-jquery","tag-php","tag-print","cat-10-id","has_thumb"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Print Dynamic Content using JavaScript, jQuery, and PHP - CodexWorld<\/title>\n<meta name=\"description\" content=\"Print dynamic content - Print hidden div content using JavaScript, jQuery, Ajax, PHP, and MySQL. Load dynamic data with Ajax load() method using jQuery and print the content of a specific div with window print() method using JavaScript.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.codexworld.com\/print-dynamic-content-using-javascript-jquery-php-mysql\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Print Dynamic Content using JavaScript, jQuery, and PHP - CodexWorld\" \/>\n<meta property=\"og:description\" content=\"Print dynamic content - Print hidden div content using JavaScript, jQuery, Ajax, PHP, and MySQL. Load dynamic data with Ajax load() method using jQuery and print the content of a specific div with window print() method using JavaScript.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.codexworld.com\/print-dynamic-content-using-javascript-jquery-php-mysql\/\" \/>\n<meta property=\"og:site_name\" content=\"CodexWorld\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/codexworld\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/codexworld\" \/>\n<meta property=\"article:published_time\" content=\"2018-10-09T05:27:04+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2018-10-09T05:30:04+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.codexworld.com\/wp-content\/uploads\/2018\/10\/print-dynamic-content-using-javascript-jquery-php-mysql-codexworld.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1366\" \/>\n\t<meta property=\"og:image:height\" content=\"768\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"CodexWorld\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@codexworldblog\" \/>\n<meta name=\"twitter:site\" content=\"@codexworldweb\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"CodexWorld\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/print-dynamic-content-using-javascript-jquery-php-mysql\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/print-dynamic-content-using-javascript-jquery-php-mysql\\\/\"},\"author\":{\"name\":\"CodexWorld\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#\\\/schema\\\/person\\\/9da51d8fa3cdefeb5ec9c69136d4baf0\"},\"headline\":\"Print Dynamic Content using JavaScript, jQuery, and PHP\",\"datePublished\":\"2018-10-09T05:27:04+00:00\",\"dateModified\":\"2018-10-09T05:30:04+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/print-dynamic-content-using-javascript-jquery-php-mysql\\\/\"},\"wordCount\":575,\"commentCount\":2,\"publisher\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/print-dynamic-content-using-javascript-jquery-php-mysql\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2018\\\/10\\\/print-dynamic-content-using-javascript-jquery-php-mysql-codexworld.png\",\"keywords\":[\"JavaScript\",\"jQuery\",\"PHP\",\"Print\"],\"articleSection\":[\"JavaScript\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.codexworld.com\\\/print-dynamic-content-using-javascript-jquery-php-mysql\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/print-dynamic-content-using-javascript-jquery-php-mysql\\\/\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/print-dynamic-content-using-javascript-jquery-php-mysql\\\/\",\"name\":\"Print Dynamic Content using JavaScript, jQuery, and PHP - CodexWorld\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/print-dynamic-content-using-javascript-jquery-php-mysql\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/print-dynamic-content-using-javascript-jquery-php-mysql\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2018\\\/10\\\/print-dynamic-content-using-javascript-jquery-php-mysql-codexworld.png\",\"datePublished\":\"2018-10-09T05:27:04+00:00\",\"dateModified\":\"2018-10-09T05:30:04+00:00\",\"description\":\"Print dynamic content - Print hidden div content using JavaScript, jQuery, Ajax, PHP, and MySQL. Load dynamic data with Ajax load() method using jQuery and print the content of a specific div with window print() method using JavaScript.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/print-dynamic-content-using-javascript-jquery-php-mysql\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.codexworld.com\\\/print-dynamic-content-using-javascript-jquery-php-mysql\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/print-dynamic-content-using-javascript-jquery-php-mysql\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2018\\\/10\\\/print-dynamic-content-using-javascript-jquery-php-mysql-codexworld.png\",\"contentUrl\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2018\\\/10\\\/print-dynamic-content-using-javascript-jquery-php-mysql-codexworld.png\",\"width\":1366,\"height\":768,\"caption\":\"print-dynamic-content-using-javascript-jquery-php-mysql-codexworld\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/print-dynamic-content-using-javascript-jquery-php-mysql\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.codexworld.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Print Dynamic Content using JavaScript, jQuery, and PHP\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#website\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/\",\"name\":\"CodexWorld\",\"description\":\"Web &amp; Mobile App Development Company\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.codexworld.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#organization\",\"name\":\"CodexWorld\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2014\\\/09\\\/codexworld-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2014\\\/09\\\/codexworld-logo.png\",\"width\":200,\"height\":19,\"caption\":\"CodexWorld\"},\"image\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/codexworld\",\"https:\\\/\\\/x.com\\\/codexworldweb\",\"https:\\\/\\\/www.linkedin.com\\\/company\\\/codexworld\",\"https:\\\/\\\/www.youtube.com\\\/codexworld\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#\\\/schema\\\/person\\\/9da51d8fa3cdefeb5ec9c69136d4baf0\",\"name\":\"CodexWorld\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g\",\"caption\":\"CodexWorld\"},\"description\":\"CodexWorld is a programming blog, one-stop destination for web professionals \u2014 developers, programmers, freelancers, and site owners.\",\"sameAs\":[\"http:\\\/\\\/www.codexworld.com\",\"https:\\\/\\\/www.facebook.com\\\/codexworld\",\"https:\\\/\\\/x.com\\\/codexworldblog\"],\"url\":\"https:\\\/\\\/www.codexworld.com\\\/author\\\/nitya192265\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Print Dynamic Content using JavaScript, jQuery, and PHP - CodexWorld","description":"Print dynamic content - Print hidden div content using JavaScript, jQuery, Ajax, PHP, and MySQL. Load dynamic data with Ajax load() method using jQuery and print the content of a specific div with window print() method using JavaScript.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.codexworld.com\/print-dynamic-content-using-javascript-jquery-php-mysql\/","og_locale":"en_US","og_type":"article","og_title":"Print Dynamic Content using JavaScript, jQuery, and PHP - CodexWorld","og_description":"Print dynamic content - Print hidden div content using JavaScript, jQuery, Ajax, PHP, and MySQL. Load dynamic data with Ajax load() method using jQuery and print the content of a specific div with window print() method using JavaScript.","og_url":"https:\/\/www.codexworld.com\/print-dynamic-content-using-javascript-jquery-php-mysql\/","og_site_name":"CodexWorld","article_publisher":"https:\/\/www.facebook.com\/codexworld","article_author":"https:\/\/www.facebook.com\/codexworld","article_published_time":"2018-10-09T05:27:04+00:00","article_modified_time":"2018-10-09T05:30:04+00:00","og_image":[{"width":1366,"height":768,"url":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2018\/10\/print-dynamic-content-using-javascript-jquery-php-mysql-codexworld.png","type":"image\/png"}],"author":"CodexWorld","twitter_card":"summary_large_image","twitter_creator":"@codexworldblog","twitter_site":"@codexworldweb","twitter_misc":{"Written by":"CodexWorld","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.codexworld.com\/print-dynamic-content-using-javascript-jquery-php-mysql\/#article","isPartOf":{"@id":"https:\/\/www.codexworld.com\/print-dynamic-content-using-javascript-jquery-php-mysql\/"},"author":{"name":"CodexWorld","@id":"https:\/\/www.codexworld.com\/#\/schema\/person\/9da51d8fa3cdefeb5ec9c69136d4baf0"},"headline":"Print Dynamic Content using JavaScript, jQuery, and PHP","datePublished":"2018-10-09T05:27:04+00:00","dateModified":"2018-10-09T05:30:04+00:00","mainEntityOfPage":{"@id":"https:\/\/www.codexworld.com\/print-dynamic-content-using-javascript-jquery-php-mysql\/"},"wordCount":575,"commentCount":2,"publisher":{"@id":"https:\/\/www.codexworld.com\/#organization"},"image":{"@id":"https:\/\/www.codexworld.com\/print-dynamic-content-using-javascript-jquery-php-mysql\/#primaryimage"},"thumbnailUrl":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2018\/10\/print-dynamic-content-using-javascript-jquery-php-mysql-codexworld.png","keywords":["JavaScript","jQuery","PHP","Print"],"articleSection":["JavaScript"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.codexworld.com\/print-dynamic-content-using-javascript-jquery-php-mysql\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.codexworld.com\/print-dynamic-content-using-javascript-jquery-php-mysql\/","url":"https:\/\/www.codexworld.com\/print-dynamic-content-using-javascript-jquery-php-mysql\/","name":"Print Dynamic Content using JavaScript, jQuery, and PHP - CodexWorld","isPartOf":{"@id":"https:\/\/www.codexworld.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.codexworld.com\/print-dynamic-content-using-javascript-jquery-php-mysql\/#primaryimage"},"image":{"@id":"https:\/\/www.codexworld.com\/print-dynamic-content-using-javascript-jquery-php-mysql\/#primaryimage"},"thumbnailUrl":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2018\/10\/print-dynamic-content-using-javascript-jquery-php-mysql-codexworld.png","datePublished":"2018-10-09T05:27:04+00:00","dateModified":"2018-10-09T05:30:04+00:00","description":"Print dynamic content - Print hidden div content using JavaScript, jQuery, Ajax, PHP, and MySQL. Load dynamic data with Ajax load() method using jQuery and print the content of a specific div with window print() method using JavaScript.","breadcrumb":{"@id":"https:\/\/www.codexworld.com\/print-dynamic-content-using-javascript-jquery-php-mysql\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.codexworld.com\/print-dynamic-content-using-javascript-jquery-php-mysql\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.codexworld.com\/print-dynamic-content-using-javascript-jquery-php-mysql\/#primaryimage","url":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2018\/10\/print-dynamic-content-using-javascript-jquery-php-mysql-codexworld.png","contentUrl":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2018\/10\/print-dynamic-content-using-javascript-jquery-php-mysql-codexworld.png","width":1366,"height":768,"caption":"print-dynamic-content-using-javascript-jquery-php-mysql-codexworld"},{"@type":"BreadcrumbList","@id":"https:\/\/www.codexworld.com\/print-dynamic-content-using-javascript-jquery-php-mysql\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.codexworld.com\/"},{"@type":"ListItem","position":2,"name":"Print Dynamic Content using JavaScript, jQuery, and PHP"}]},{"@type":"WebSite","@id":"https:\/\/www.codexworld.com\/#website","url":"https:\/\/www.codexworld.com\/","name":"CodexWorld","description":"Web &amp; Mobile App Development Company","publisher":{"@id":"https:\/\/www.codexworld.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.codexworld.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.codexworld.com\/#organization","name":"CodexWorld","url":"https:\/\/www.codexworld.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.codexworld.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2014\/09\/codexworld-logo.png","contentUrl":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2014\/09\/codexworld-logo.png","width":200,"height":19,"caption":"CodexWorld"},"image":{"@id":"https:\/\/www.codexworld.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/codexworld","https:\/\/x.com\/codexworldweb","https:\/\/www.linkedin.com\/company\/codexworld","https:\/\/www.youtube.com\/codexworld"]},{"@type":"Person","@id":"https:\/\/www.codexworld.com\/#\/schema\/person\/9da51d8fa3cdefeb5ec9c69136d4baf0","name":"CodexWorld","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g","caption":"CodexWorld"},"description":"CodexWorld is a programming blog, one-stop destination for web professionals \u2014 developers, programmers, freelancers, and site owners.","sameAs":["http:\/\/www.codexworld.com","https:\/\/www.facebook.com\/codexworld","https:\/\/x.com\/codexworldblog"],"url":"https:\/\/www.codexworld.com\/author\/nitya192265\/"}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2018\/10\/print-dynamic-content-using-javascript-jquery-php-mysql-codexworld.png","jetpack_shortlink":"https:\/\/wp.me\/p6bxIh-V0","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/posts\/3534","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/comments?post=3534"}],"version-history":[{"count":3,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/posts\/3534\/revisions"}],"predecessor-version":[{"id":3538,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/posts\/3534\/revisions\/3538"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/media\/3536"}],"wp:attachment":[{"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/media?parent=3534"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/categories?post=3534"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/tags?post=3534"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}