I want to call a javascript function myfunction() from php code. the code is as follows:
<script>
function myfunction() {
var r = confirm("Are you sure ? ");
if (r == true) {
//delete file from database with id b_id
}
<?php header("Refresh:0"); ?>
}
</script>
I want to call the js function from this php code.
<?php
while(//fetched database elements one by one)
{
//$b_id fetched from database.
echo "<button class='w3-display-topright pe-7s-close-circle w3-xxlarge w3-button' onclick="myfunction($b_id);"></button>
}
?>