-2
我不知道爲什麼我的代碼獲得了「selectedText」,「不確定」下得到了一個未定義值超出下拉列表
$("#DeviceType").change(function() {
selectedText = $(this).find("option:selected").text();
debugger;
$.ajax({
url: "@Url.Action("modelProducer","AdminTool")",
data:{ "turbineType": selectedText, },
type:'POST',
success:function(data) {
modelProducerResult = data;
}
});
});
我認爲你應該使用VAL(),而不是文本() – bigbounty
@bigbounty試圖selectedText = $(本).find( 「選項:選擇」)VAL()。但仍然是相同的結果 – mortezasol
這將是很好,如果你可以添加一個實際的[mcve]。此外,爲了便於閱讀,如果您可以修復問題中代碼的縮進情況,那將會很好。 – Ivar