Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/427.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/jquery/82.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 如何获取从ajax调用接收的HTML标记的值_Javascript_Jquery_Html_Ajax - Fatal编程技术网

Javascript 如何获取从ajax调用接收的HTML标记的值

Javascript 如何获取从ajax调用接收的HTML标记的值,javascript,jquery,html,ajax,Javascript,Jquery,Html,Ajax,我通过ajax调用从vbscript页面接收下面的html <html> <body> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tbody> <tr> <td width="100%" valign="top"> &l

我通过ajax调用从vbscript页面接收下面的html

<html>
<body>
    <table width="100%" border="0" cellpadding="0" cellspacing="0">
        <tbody>
            <tr>
                <td width="100%" valign="top">
                    <div id="xyz"></div>
                    <input name="a1" type="hidden" value="">
                    <input name="a2" type="hidden" value="586546d5">
                    <input name="a3" type="hidden" value="13025">
                    <br clear="all">
                </td>
            </tr>
        </tbody>
    </table>
</div>
</body>
</html>



在ajax中,是否可以在
name=“a2”
的位置获取输入标记的值。i、 e我们希望变量中的值
586546d5

您可以将html字符串转换为jquery对象,然后在其中获取元素:

$(returnehtml).find('[name=a2]').val();
使用查询选择器

document.querySelector('input[name=a2]').value

我试过这个:var html=$.parseHTML(数据);var result=$(html).find('[name=a2]').val();警报(结果);你能分享数据的价值吗?对不起,我可以分享它,因为它是有价值的数据,但HTML的格式与上面描述的几乎相同。是的,拼写错误已更正。我想你可以编辑一下