PHP Ajax Display Dynamic MySQL Data in Bootstrap Modal

===============[getcode.php]====================== <!--php $id=$_GET['allrec']; include 'useroperation.php'; $dcp = new Dbconnection(); $conn = $dcp--->connect(); $sql="select *from gradienttb where id='$id'"; $result=$conn->query($sql); if($result->num_rows>=0){ $row=$result->fetch_assoc(); echo json_encode($row); // echo $row['id']."".$row['cidd']; } ?> ================[ json part ]=================== <script> function showdetails(a){ var allrec=a.id; console.log(allrec); $.ajax({ url:"getcode.php", method:"GET", data:{"allrec":allrec}, success:function(response){ var dataa=JSON.parse(response); $("#sid").html(dataa['cidd']); }, error:function(err){ alert("err.error"); }, }); } </script> =================[ Get ID from Database ]================== echo "<a href='#' id='$row[id]' onclick='showdetails(this);' data-toggle='modal' data-target='#myModal'><div>".$row[cname]."</div></a>"; ===========================================================

agyanadda

Author & Editor

Has laoreet percipitur ad. Vide interesset in mei, no his legimus verterem. Et nostrum imperdiet appellantur usu, mnesarchum referrentur id vim.

0 $type={blogger}:

Post a Comment