【发布时间】:2021-10-31 04:44:44
【问题描述】:
我有一个类似的脚本
$.each(result.Data, function (key, value) {
if (value.RateName === "")
return;
$('#AllRateList')
.append($("<option></option>")
.attr("value", value.Id)
.text(value.RateName));
});
$('select').change(function () {
selectedRateId = $(this).val()
console.log(selectedRateId)
});
当我在本地主机上选择一个选项时,我可以从日志中看到 id。 我想从 jquery 中获取这个 selectedRateId 并在按下保存按钮时将其用于更新。 这是带有 customerId 的服务
public void UpdateRatePlan(int customerId)
{
var updateProductVoices = (from product in productRepository.All()
join productVoice in productVoiceRepository.All()
on product.Id equals productVoice.Id
where product.CustomerId == customerId && product.Status == "A"
select productVoice).ToList();
}
如果需要,我可以添加更多详细信息。我想不通。
【问题讨论】:
-
或者您使用 html 表单,或者您可以使用 ajax 调用。选择了一个。
-
我只是在 html 中使用 select。但我更喜欢 html .s
标签: jquery .net asp.net-mvc