|
|
|
จะใช้ jquery คำนวนราคาสินค้ายังไงถ้าราคาอยู่ในฐานข้อมูล |
|
|
|
|
|
|
|
พอจะมี code ตัวอย่างที่ทำไว้ มาให้ดูไหมครับ
|
|
|
|
|
Date :
2015-08-29 17:27:12 |
By :
nPointXer |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ใช้ ajax ครับ
Code (PHP)
<?php
session_start();
$_SESSION['rownum']=isset($_SESSION['rownum'])? $_SESSION['rownum'] : 0;
if(isset($_POST['getdata'])){
echo '<tr><td>'.(++$_SESSION['rownum']).'</td><td>Message '.$_POST['value'],' '.$_SESSION['rownum'].'</td></tr>';
exit;
}
if(isset($_GET['cleardata'])) { $_SESSION['rownum']=0; exit; }
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" >
<title>Ajax TEST</title>
</head>
<body>
<!-- ///////// หาโหลดมาใช้ด้วยนะครับ ////////////////////// -->
<script language="javascript" src="../jquery-2.1.1.min.js"></script>
<!-- ///////////////////////////////////////////// -->
<script language="javascript" type="text/javascript">
$(document).ready(function(e) {
$('#select_job').change(function(e) {
if($(this).val()>''){
$.ajax({ url: '', type:'POST', data:{ getdata: 'test', value: $(this).val() }}).done(function(msg){
$('#testTB').append(msg);
});
}
});
$('button').click(function(e){
$('#testTB').empty().append('<tr><th>Item</th><th>Description</th></tr>');
$.ajax({ url:'?cleardata=1'});
});
});
</script>
<select id="select_job" >
<option value="">-- Select Your Job --</option>
<option value="getYourJob1">getYourJob1</option>
<option value="getYourJob2">getYourJob2</option>
</select><br />
<button type="button">clear</button>
<table border="1" id="testTB">
<tr><th>Item</th><th>Description</th></tr>
</table>
</body>
</html>
|
|
|
|
|
Date :
2015-08-29 19:59:56 |
By :
NewbiePHP |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 05
|