我試圖在下拉列表中選擇數據,然后提交到劍道網格中。但是,數據未能插入到網格中。任何人有想法或解決方案?HTML 提交按鈕<button class="k-button" id="btnSave" value="submit" style="float:right; padding: 5px 20px; border-radius: 4px;" >Submit</button>JavaScript 按鈕提交 //AJAX call for button $("#btnSave").kendoButton(); var button = $("#btnSave").data("kendoButton"); button.bind("click", function(e) { var test = $("#accountLedger").val() $.ajax({ url: "../GroupManagement/get.php", type: "POST", data: { method: "addGroup", accountLedgerID: $("#accountLedgerID").val() }, success: function () { kendo.alert ('success');JavaScript 下拉菜單 $("#accountLedger").kendoDropDownList({ dataTextField: "accountLedgerName", dataValueField: "accountLedgerID", optionLabel: "Choose account ledger", dataSource: { transport: { read: { url: "./getCoaGroup.php", type: "POST", data: function() { return { method: "getAccLedger", } } }, }, }, //change: onChange(), change: function(e){ console.log(this.value()); $('#grid').data('kendoGrid').dataSource.read(); homogeneous.read(); } }).data('kendoDropDownList'); dropdownlist = $("#accountLedger").data("kendoDropDownList");這是我的輸出如果您看到圖片,列分類帳名稱上方的網格沒有數據。它假設用戶選擇下拉列表然后單擊提交。之后,下拉列表中的選定數據將插入到網格中。希望任何人都可以對此提供任何參考。謝謝!
2 回答

慕虎7371278
TA貢獻1802條經驗 獲得超4個贊
: {'transport' 和 'read' 之后應該有你的代碼。
下面這部分代碼固定:
dataSource: {
transport: {
read: {
url: "./getCoaGroup.php",
type: "POST",
data: function() {
return {
method: "getAccLedger",
}
}
},
},

Cats萌萌
TA貢獻1805條經驗 獲得超9個贊
我不確定它是否有效,但您是否嘗試將其更改accountLedgerID
為其他名稱。我也遇到了同樣的問題,可能是因為變量名混淆了。
JavaScript 按鈕提交
accLedgerID: $("#accountLedgerID").val()
PHP
$accLedgerID= (isset($_POST['accLedgerID']) ? $_POST['accLedgerID'] : '');
- 2 回答
- 0 關注
- 236 瀏覽
添加回答
舉報
0/150
提交
取消