gpt4 book ai didi

jquery - 根据下拉列表的变化显示文本框中的值

转载 作者:行者123 更新时间:2023-12-01 04:57:14 25 4
gpt4 key购买 nike

我有一个带有下拉列表的部分 View ,并且在更改下拉列表时,我需要更新相应文本框中的值,但即使该值存在,该值也不会显示。请帮忙

我的代码如下所示

@Html.DropDownListFor(model => model.ReportingAgencies, new SelectList(Model.ReportingAgencies, "SelectedAgency.AgencyGuid", "SelectedAgency.Name"), "--Select An Agency--", new { id = "dropDownReportAgencies" })
</td>
</tr>
<tr class="seperator"></tr>
<tr class="seperator"></tr>

<tr>
<td style="width: 100px;">@Html.LabelFor(model => model.W2StateLocal.Wages)</td>
<td> @Html.EditorFor(model => model.W2StateLocal.Wages)</td>
</tr>
<tr>
<td style="width: 100px;">@Html.LabelFor(model => model.W2StateLocal.Tax)</td>
<td>@Html.EditorFor(model => model.W2StateLocal.Tax)</td>
</tr>
</table>
<div id="rightButtonControls">
@if (Model.IsEditable)
{
<button id="btnSave" value="save">Save</button>
}
</div>
</fieldset>
}

@Html.HiddenFor(model => model.CompanyId, new { id = "CompanyId" })
@Html.HiddenFor(model => model.EmployeeId, new { id = "EmployeeId" })
@Html.HiddenFor(model => model.FilingYear, new { id = "FilingYear" })


<script type="text/javascript">
$(document).ready(function () {
$("#divLoader").css('display', 'none');
$('#dropDownReportAgencies').change(function () {
var selectedAgency = $('#dropDownReportAgencies option:selected').val();
alert(selectedAgency);
var CompanyId = $('#CompanyId').val();
var EmployeeId = $('#EmployeeId').val();
var FilingYear = $('#FilingYear').val();
var url = '@Url.Action("W2State", "W2Generation")';
$.get(url, { agencyId: selectedAgency, companyId: CompanyId, employeeId: EmployeeId, filingYear: FilingYear },
function (data) {
}
);
});
});

但是这些值没有显示在文本字段中。请帮忙解决这个问题

最佳答案

我必须返回html(数据)而不是返回函数(数据)

关于jquery - 根据下拉列表的变化显示文本框中的值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13576334/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com