亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

更改值時如何使用onchange自動更新mysql

更改值時如何使用onchange自動更新mysql

PHP
慕工程0101907 2021-08-28 16:19:18
我正在編輯一個應該在值更改時更新數據庫的代碼,但是它不起作用,希望有人能幫我修復它。我正在使用 DISTINCT 獲取數據并需要同時更新一些數據。它可以顯示值,但不能保存在數據庫中。例如,我將使用 DISTINCT 來獲取一些具有相同日期的數據,并且我將使用該代碼同時更改這些數據中的值。索引.php<script>    window.onload = function() {        $(".cal_amount").change(function() {            var auto_array = {};            //Step 1- On change use The closest() method to get the all input elements value of selected element row.            form_data = $(this).closest('tr').find('input, select');            //Step 2- On change Use map to store input elements value with name as key in the array.            var myArray = $.map(form_data, function(element) {                    auto_array[element.name] = element.value;                    //return {name: element.name, value: element.value};            });  form_data = $(this).closest('tr').find('input,select').serialize();        $.ajax({                data: {                    action: 'update_price',                    form_data: form_data,                },                url: 'updates_ok.php',                type: 'post',                beforeSend: function() {                },                success: function(data) {                    if(data == 1){                    alert('update sucessful')}                }            });    });    };    </script><script>    window.onload = function() {        $(".day_record").change(function() {            var auto_array = {};            //Step 1- On change use The closest() method to get the all input elements value of selected element row.            form_data = $(this).closest('tr').find('input, select');            //Step 2- On change Use map to store input elements value with name as key in the array.            var myArray = $.map(form_data, function(element) {                    auto_array[element.name] = element.value;                    //return {name: element.name, value: element.value};            });
查看完整描述

1 回答

  • 1 回答
  • 0 關注
  • 142 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號