<?php if(isset($_REQUEST['dataVal'])){ // ส่วนการรับข้อมูลแล้ว แสดงผลออกไปให้ กับคำสั่ง $.ajax(); echo 'Response DataValue = ' , $_REQUEST['dataVal']; exit; } $mysql=new mysqli('localhost', 'test', 'test', 'test') or die( mysqli_connect_error() ); $rs = $mysql->query('select id, value from table where 1'); $option_select = ''; $show_first='1'; while($ro=$rs->fetch_assoc()){ $slc=$ro['id']==$show_first? 'selected' : ''; $option_select .= "<option value='$ro[id]' $slc >$ro[value]</option>"; } ?> <!doctype html> <html> <head> <meta charset="utf-8"> <title>Untitled Document</title> </head> <script src="../jquery-2.1.1.min.js" ></script> <script language="javascript"> $(document).ready(function(e) { $(".nav select").change(function(e){ if(confirm("Do you want send "+$(this).find("option:selected").text() )){ $.ajax({ type: 'GET', data: { dataVal: $(this).val() }}).done( function(msg){ alert( msg ); }); } }); }); </script> <body> <div class="nav"> <select> <option value="">Please Select </option> <?=$option_select?></select> </div> </body> </html>
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง