所以我的問題是這樣的 -使用阿賈克斯基於兩個不同的下拉菜單更新標籤
我有一個頁面有兩個下拉菜單和一個標籤。我建立了兩個下拉菜單,這兩個下拉菜單可以正常工作,但是我現在要做的就是將標籤的文本設置爲由兩個下拉菜單確定的值。
現在我已經設置了,所以當第二個下拉列表發生變化時,它會調用服務器來確定標籤的值。我面臨的問題是,我不知道如何獲取變更函數中第二個下拉列表中第一個下拉列表的值 - 我是否錯過了一些非常簡單的操作?我一直在使用(「#elementID」)嘗試。VAL(),但我得到的錯誤「對象不支持屬性或方法‘VAL’」
代碼如下─任何幫助超級感謝!
$(function() {
var cascadingDropDownRelease = new CascadingDropDownAssociation();
//binding change event of the "make" select HTML control
// the cascading drop downs are working as expected
$('#make').on('change', function() {
var selectedArea = $(this).val();
//if selected other than default option, make a AJAX call to server
if (selectedArea !== "-1") {
$.post('/Association/GetFullContainers',
{ selectedArea: selectedArea },
function (data) {
cascadingDropDownRelease.resetCascadingDropDowns();
cascadingDropDownRelease.getContainerSuccess(data);
});
}
else {
//reset the cascading dropdown
cascadingDropDownRelease.resetCascadingDropDowns();
}
});
$('#container').on('change', function() {
//this is there I am having the problem.
var selectedArea = ("#make").val();
var selectedContainer = $(this).val();
if (selectedContainer !== "-1") {
$.post('/Assocation/GetESN',
{ selectedArea: selectedArea, selectedContainer: selectedContainer },
function (data) {
cascadingDropDownRelease.resetCascadingDropDowns();
cascadingDropDownRelease.getESNSuccess(data);
});
}
else {
cascadingDropDownRelease.resetCascadingDropDowns();
}
});
});
'VAR selectedArea =( 「了#make」)VAL();'應該是'無功selectedArea = $(「#使「).val();' – 2015-02-10 18:25:34