我正在發佈發佈問題。當我用按鈕增加總價值時,值顯示,但當我點擊請求按鈕,然後所有發佈更新但餘額不更新。我檢查數據庫插入到「你有轉移$ [對象對象]帳戶餘額」。請幫助解決問題並幫助我達到完美。阿賈克斯發佈但對象錯誤
$(function(){
\t
var theTotal = 10;
$('.add').click(function(){
theTotal = Number(theTotal) + Number($(this).val());
$('.total').text(theTotal.toFixed(2));
});
$('.sub1').click(function(){
\t if(theTotal > 10) {
theTotal = Number(theTotal) - Number($(this).val());
\t };
$('.total').text(theTotal.toFixed(2));
});
$('.sub2').click(function(){
\t if(theTotal > 10) {
theTotal = Number(theTotal) - Number($(this).val());
\t };
$('.total').text(theTotal.toFixed(2));
});
$('.sub3').click(function(){
\t if(theTotal > 10) {
theTotal = Number(theTotal) - Number($(this).val());
\t };
$('.total').text(theTotal.toFixed(2));
});
var af = $('.total').text(theTotal.toFixed(2));
\t
\t $('#request').click(function(){
\t \t $.ajax({
\t \t \t type:'POST',
\t \t \t url:window.location.protocol+'//'+window.location.host+'/?add=fund',
\t \t \t data:'qun='+af,
\t \t \t cache:false,
\t \t \t beforeSend:function(){
\t \t \t \t $('html *').addClass('op-progress');
\t \t \t }, success:function(html){
\t \t \t \t $('html *').removeClass('op-progress');
\t \t \t \t document.location.href=_url+'/?add=fund';
\t \t \t }
\t \t });
\t });
\t
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.0/jquery.min.js"></script>
<table style="margin-bottom:15px;">
\t <tr>
\t \t <td>
\t \t \t <button class="sub3 p_btn" value="10"><<<</button>
<button class="sub2 p_btn" value="10"><<</button>
\t \t \t <button class="sub1 p_btn" value="10"><</button>
\t \t </td>
\t \t \t \t \t \t
\t \t <td>
\t \t \t <span class="f_mb_dol">$</span>
\t \t \t <span class="total f_mb_text"></span>
\t \t \t <div class="f_mb_dol">usd</div>
\t \t </td>
\t \t \t \t \t \t
\t \t <td>
\t \t \t <button class="add p_btn" value="10">></button>
<button class="add p_btn" value="10">>></button>
\t \t \t <button class="add p_btn" value="10">>>></button>
\t \t </td>
\t </tr>
</table>
\t \t \t \t
<table>
<tr>
\t <td><button id="request" class="btn_enable" style="cursor:pointer;"><span>Transfer balance</span></button></td>
</tr>
</table>
哪裏是PHP和MySQL的代碼? – hassan