Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/376.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/visual-studio-2010/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 想从js中的下拉列表中找到隐藏字段中的fethch值吗_Javascript_C# - Fatal编程技术网

Javascript 想从js中的下拉列表中找到隐藏字段中的fethch值吗

Javascript 想从js中的下拉列表中找到隐藏字段中的fethch值吗,javascript,c#,Javascript,C#,从DDLContryName下拉列表中,我希望获取HDNConCountryCode中的值 function getWorkCenter() { debugger; var SelectedCountryCode = $('#ddlCountryName').val(); $.ajax({ type: "POST", contentType: "application/json; charset=utf-8", url: "

从DDLContryName下拉列表中,我希望获取HDNConCountryCode中的值

function getWorkCenter() {
    debugger;
    var SelectedCountryCode = $('#ddlCountryName').val();
    $.ajax({
        type: "POST",
        contentType: "application/json; charset=utf-8",
        url: "FocussedMktBenefit.aspx/GetWorkCenter",
        data: '{"sPlant":"' + SelectedCountryCode + '"}',
        dataType: "json",
        success: function (data) {
            var jsonProcessDetails = jQuery.parseJSON(JSON.stringify(data.d));    
        },
        error: function (Result) {
            alert("Error with AJAX callback");
        }
    });
}
数据也来自使用focusedmktfreement.aspx/GetWorkCenter的.cs页面,但如何进入隐藏字段是个问题

<select id="hdnCountryCode" style="display:none;">
    <option value="123">aaa</option>
    <option value="456">bbb</option>
</select>

你是这个意思吗?

我猜你想做这样的事情

var jsonProcessDetails = jQuery.parseJSON(JSON.stringify(data.d));
$("hdnCountryCode").val(jsonProcessDetails);
或者,如果您在aspx页面上,并且您的隐藏字段是runat=server,那么


你的名字不是一个下拉列表吗?您希望从var SelectedCountryCode=$'ddlcontryName'.val;,得到什么类型的值;?啊,没关系,这是一个选择元素。你能解释一下HDNConCountryCode是什么吗?它是一个输入字段吗?或者发布一些HTML?hdnCountryCode是隐藏字段,我想在其中存储来自url:FocusedMktBenefit.aspx/GetWorkCenter的数据,此函数。如果隐藏字段的id为hdnCountryCode,您就不能使用$'hdnCountryCode.val;`?
var jsonProcessDetails = jQuery.parseJSON(JSON.stringify(data.d));
$("[id$=hdnCountryCode]").val(jsonProcessDetails);