<td class="text-center"> <button data-toggle="modal" data-target="#view-modal" data-cmreq-id="<?php echo $row["cmreq_id"]; ?>" data-cmreq-code="<?php echo $row['cmreq_code']; ?>" id="Btngetcmreq" name="Btngetcmreq" value="" class="btn btn-sm btn-info"><i class="glyphicon glyphicon-search"></i> View</button> </td> ส่วนของ script <script> $(document).ready(function(){ $(document).on('click', '#Btngetcmreq', function(e){ e.preventDefault(); var cmid = $(this).data('cmreq-id'); // it will get id of clicked row //var cmcode = $(this).data('cmreq-code'); $('#dynamic-content').html(''); // leave it blank before ajax call $('#modal-loader').show(); // load ajax loader $.ajax({ url: 'getcmreq.php', type: 'POST', data: 'cmreq_id='+cmid, dataType: 'html' }) .done(function(data){ console.log(data); //$('#dynamic-content').html(''); $('#dynamic-content').html(data); // load response $('#modal-loader').hide(); // hide ajax loader }) .fail(function(){ $('#dynamic-content').html('<i class="glyphicon glyphicon-info-sign"></i> Something went wrong, Please try again...'); $('#modal-loader').hide(); }); }); }); </script> ส่วนของ php <div class="table-responsive"> <table id="listreqitem" name="listreqitem" class="table table-striped table-bordered"> <tr> <th class="text-center">No.</th> <th class="text-center">PRODUCT CODE</th> <th class="text-center">PRODUCT NAME</th> <th class="text-center">STOCK</th> <th class="text-center">Min. STOCK</th> <th class="text-center">Req.QTY</th> <th class="text-center">CM Dis.1</th> <th class="text-center">CM Dis.2</th> </tr> <?php include ('config/conn.php'); $cmid = json_decode(file_get_contents("php://input"), true); $sql_cmreq = "SELECT * FROM cm_request WHERE cmreq_id = '".$cmid."' "; $querycm = $conn->query($sql_cmreq); $rowcm = $querycm->fetch_assoc(); $cmreqID = $rowcm['cmreq_id']; $sql = "SELECT * FROM items i LEFT JOIN product_master_detail p ON p.product_id = i.product_id WHERE i.cmreq_id = '".$cmreqID."'"; $query = $conn->query($sql); $listprocessing = array(); while ($row = $query->fetch_assoc()) { $listprocessing[] = $row; //extract($row); ?> <tr> <td><?php echo $row['item_code']; ?></td> <td><?php echo $row['item_desc']; ?></td> <td class="text-center"><?php echo $row['item_qty']; ?></td> <td class="text-center"><?php echo $row['item_paycmchk']; ?></td> <td class="text-center"><?php echo $row['product_stock']; ?></td> <td class="text-center"><?php echo $row['product_minstock']; ?></td> </tr> <?php } ?> </table> </div>
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง