如何在jquery中获取HiddenFor控件的值 [英] how to get the value of a HiddenFor control in jquery
本文介绍了如何在jquery中获取HiddenFor控件的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个隐藏的控件
@Html.HiddenFor(m => m.SchedulingProfileDetails.Id)
我正在尝试访问我的jquery中此隐藏字段中的值,然后尝试将该值传递给控制器
I am trying to access the value in this hidden field in my jquery and then trying to pass the value to controller
var id = $("#SchedulingProfile_Id").val();
$.ajax({
url: rootUrl + 'SchedulingProfile/SaveDetails',
type: "POST",
data: ({
schedulingProfileId: schedulingProfileId,
});
但是我在id中得到了空值.请帮帮我
but I am getting null value in id. Please help me out
推荐答案
我可能是错的,但不仅如此:
I could be wrong, but isn't it merely that:
var id = $("#SchedulingProfile_Id").val();
需要是:
var id = $("#SchedulingProfileDetails_Id").val();
?
这篇关于如何在jquery中获取HiddenFor控件的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文