Transmission problems is empty when the value of the background pass layui batch operation

 

 

 As shown, the front appearance, data parameters for the

[

{"good_id":1,"good_name":"标样-总磷","good_num":"BY400014","pid":10,"first_pid":1,"good_standard":"1.46mg/L","good_cas":"7220-81-7","good_spe":"1mL","normal_price":"500.00","good_stock":"322","good_indate":"1600876800","cash_sale":"1","good_url":"/uploads/20190923/eaa8577dd76344a3ed15cc3ca0146a50.jpg","company":"TMstandard","good_sort":99,"good_new":1,"good_promotion":1,"create_time":"1569222082"}

,{"good_id":2,"good_name":"水中甲醛(HJ601-2011水质甲醛的测定乙酰","good_num":"BW20040-100-W-20","pid":14,"first_pid":2,"good_standard":"100mg/L","good_cas":"50-00-0","good_spe":"20mL","normal_price":"90.00","good_stock":"280","good_indate":"1630512000","cash_sale":"1","good_url":"/uploads/20190923/8ca481784cc15ee27399e754d788aad1.jpg","company":"坛墨质检","good_sort":99,"good_new":1,"good_promotion":1,"create_time":"1569222248"}

]

Probably want to bulk delete two records, then the value of life and death can not pass into the background, return pass past a look that is undefined, the card the morning! ! ! !

Final solution, and you can pass the acquired values ​​{ "id": [ "1", "2"]}, as used herein, of course, the process json_encode dedicated json

checkStatus.data the Data = var; 
                    var the above mentioned id = new new Array (); // there is a small episode here, when you create an empty array, you must use Array, array will error, laughing cry, foundation is not solid ah 
                    console.log ( the JSON.stringify (Data)); 
                    for (var Data in I) { 
                        ID [I] = Data [I] .good_id; 
                    } 
                    $ .ajax ({ 
                        URL: '', // background controller 
                        type: 'post', 
                        Data: { 
                            'ID': ID 
                        }, 
                        dataType: 'JSON', 
                        Success: function (MSG) { 
                            the console.log (MSG);  
                        }
                    });  

Guess you like

Origin www.cnblogs.com/dayin1/p/11578870.html