code in php to add parent Element on array
<?php $array1=array(); for($i=1;$i<=10;$i++) { array_push($array1,['id'=>$i]); } $array2->numbers=$array1; echo $final_output= json_encode($array2); ?>
Remember that this technique has 1 drawback, watch the video above to understand it. Comment down if you have any questions.
Source Code :- dynamic.php
<head>
<script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){ $("b").click(function()
{
document.getElementById("include").innerHTML = "<?php echo include('Second.php');
?> "; });
$(document).on("click", "a.remove" , function()
{ $(this).parent().remove(); }); });
</script>
</head>
<body>
<b><input type='submit' value='Add second page'></b>
<div id='include'></div>
</body>