|
|
|
Javascript - สอบถามการ Query ฐานข้อมูล โดยการเลือกจาก Checkbox แบบ Real Time |
|
|
|
|
|
|
|
Ajax
|
|
|
|
|
Date :
2014-02-05 10:33:41 |
By :
mr.win |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (PHP)
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript">
$(document).ready(function(){
var cate;
$("input.category").change(function(){
cate = $(this).val();
$.post("product_list.php",{category:cate},function(data){
$("#container").html(data);
});
});
});
</script>
<input type='radio' class='category' value='iphone5s' />iPhone 5S
<input type='radio' class='category' value='G-note3' />Galaxy Note3 <br />
<div id="container" style="width:500px;height:300px;border:1px solid black;overflow:auto;"></div>
product_list.php
<?php
include("connectdb.php");
$sql = "select * from tb1 where category='{$_POST["category"]}' ";
$res = mysqli_query($sql) or die(mysqli_error());
while($data = mysqli_fetch_assoc($res)){
......
.........
...........
}
?>
|
|
|
|
|
Date :
2014-02-07 10:38:52 |
By :
sakuraei |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 01
|