【问题标题】:Fetch form variables in node在节点中获取表单变量
【发布时间】:2017-08-01 06:45:45
【问题描述】:

向 URL 发出请求后,我得到一个 HTML 页面作为响应。响应的页面包含我要获取的变量的表单。

输出

<input type="hidden" name="Flag_CustomerStatus" value="1">
<input type="hidden" name="Flag_InstantPayment" value="" />
<input type="hidden" name="txtMerchNum" value="90">
<input type="hidden" name="txtHttp" value="http://www.mywebsite.com/ThankYouPage.php">
<input type="hidden" name="txtMerchRequest" value="add_cc">
<input type="hidden" name="action" value="">
<input type="hidden" name="IsPostBack" value="True">
<input type="hidden" name="Lng" value="en">

我熟悉 Php,可以使用 $_POST['Flag_CustomerStatus'] 提取这些变量,但在 Node Js 中实现时无法解析它们。

请推荐

【问题讨论】:

    标签: javascript php node.js


    【解决方案1】:

    在你获得成功的 ajax 结果后 - 你可以将这个 html 写入其他 div 像这样

    <div style='display:none;' id='hidden_div'>
    ....
    ....
    $('#hidden_div').html(your_html);
    

    之后,您可以通过 JQuery 从任何隐藏的输入中选择任何值

    或者第二种解决方案是 - 你可以改变 php 端 并在它之后获取带有值的数组 - 您可以生成 HTML

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-08-04
      • 1970-01-01
      • 2013-04-14
      • 2020-06-13
      • 2012-02-14
      • 1970-01-01
      • 2021-07-05
      • 2016-06-10
      相关资源
      最近更新 更多