0
我一直在研究一個多星期才能完成這項工作。我對jquery知之甚少,甚至在IT界向我的一些朋友伸出援手,但迄今爲止還沒有人能夠幫助我。我基本上是自學成才的,所以如果編碼看起來都很奇怪,我很抱歉。任何有關此事的幫助將不勝感激。未能正確傳遞變量
我有一個重複的形式(如下所示)在一個jQuery的手風琴。我只想讓ajax提交正確的數據並保持當前單元格關閉,這樣用戶在每次按下按鈕時都不必重新打開它。
function dg1(dgr, v1, v2, v3) {
var MM_update = document.getElementById(v1);
var id = document.getElementById(v2);
var green_disable = document.getElementById(v3);
$.ajax({
type: "POST",
url: 'disable.php',
data: { MM_update: MM_update.value, id: id.value, green_disable: green_disable.value
},
dataType: "html",
success: function(html){ var foo = dgr.id; $('#' + foo).html(html);
document.getElementById('submitDisGreen').disabled = true; }
});
}
這是重複的形式。
<form name="disable" method="POST" action="">
<input type="submit" id="submitDisGreen" value="Disable" <?php if ($row_Recordset1['green_disable'] != NULL) echo "disabled=\"disabled\"";?> onClick="dg1('dgr<?php echo $row_Recordset1['id']; ?>', 'MM_update<?php echo $row_Recordset1['id']; ?>', 'id<?php echo $row_Recordset1['id']; ?>', 'green_disable<?php echo $row_Recordset1['id']; ?>'); return false;"/>
<input type="hidden" name="MM_update" id="MM_update<?php echo $row_Recordset1['id']; ?>" value="disableGreen" />
<input type="hidden" name="id" id="id<?php echo $row_Recordset1['id']; ?>" value="<?php echo $row_Recordset1['id']; ?>" />
<input type="hidden" name="green_disable" id="green_disable<?php echo $row_Recordset1['id']; ?>" value="<?php echo $row_Recordset2['first_name']; ?> <?php echo $row_Recordset2['last_name']; ?>" />
</form>
當用戶點擊'submitDisGreen'輸入時,單元格是否關閉? – Aliou
nope,單元格保持打開狀態。 – user3385139
所以當你點擊按鈕時,ajax調用完成,並在此之後關閉Accordion選項卡? –