php - 来自 html 中单个页面的多个 Web 服务请求

标签 php jquery html ajax web-services

我正在尝试在一个页面中提交三个表单。但是我卡在了一点。 我想在第一个表格中验证手机号码。然后在最终表单提交中使用该手机号码

我已经尝试在单一表单中使用它,但是我如何发送网络请求以使用验证移动按钮发送验证 pin。

我有这样的三种形式,

    //First Form Take Mobile Number, web service will send verification Pin as reply to this action
    <form name="PhoneVerification" action="url to phone verification web service" >
    Phone Number: <input type="text" name ="number" id="phone">
    <input type="submit" name ="submit1" id="submit1">Verify Mibile Number</input>
    </form>

//Second Form verifies pin Locally which is sent by first service
    <form name="PinVerification" action="verify pin came from previous web service">
    Verification Pin(Sent on Mobile Number): <input type="text" name ="pin" id="pin">
    <input type="submit" name ="submit2" id="submit2">Verify Pin</input>
    </form>

//Third Form Will Take Mobile Number Previously Entered. and email/password and Complete Signup
    <form action="web service call to complete signup">
    Email: <input type="text" name ="email" id="email">
    Password: <input type="text" name ="pass" id="pass">
    PasswordAgain: <input type="text" name ="passAgain" id="passAgain">
    <input type="submit" name ="submit3" id="submit3">Complete Signup</input>
    </form>

问题是在提交表单后刷新页面时我无法获取电话号码的值。

我阅读了一些关于使用 AJAX 的帖子,但是我如何在这种情况下使用 Ajax。 我怎样才能做到这一点。使用 AJAX,或使用 PHP。

最佳答案

    Id must be unique in your html page. In above code id="phone" be present in first to forms. the second form in pinVerfication right but there is an same id = "phone" . please change it and make an another try. third form have also same problem

    //Second Form verifies pin Locally which is sent by first service
        <form name="PinVerification" action="verify pin">
        Verification Pin(Sent on Mobile Number): <input type="text" name ="number" id="pin">
        <input type="submit" name ="submit2" id="submit2">Verify Pin</input>
        </form>

/Third Form Will Take Mobile Number Previously Entered. and email/password and Complete Signup
    <form action="web service call to complete signup">
    Email: <input type="text" name ="email" id="email">
    Password: <input type="text" name ="pass" id="pass">
    PasswordAgain: <input type="text" name ="passAgain" id="passAgain">
    <input type="submit" name ="submit3" id="submit3">Complete Signup</input>
    </form>

关于php - 来自 html 中单个页面的多个 Web 服务请求,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21299420/

相关文章:

php - Imagick max 资源在 php 脚本中与 php 命令行不同

javascript - onhashchange 未正确触发

python - BeautifulSoup get_text() 函数包括 css

javascript - 如何在 HTML 页面的 &lt;title&gt;&lt;/title&gt; 标签内运行脚本?

php - 找不到 Composer PSR-4 自动加载类

php - 无法弄清楚 foreach 循环

javascript - 如何将媒体规则动态添加到元素

regex - 正则表达式模式 : alphanumeric(compulsory) , 一些特殊字符(可选)

php - 保护 PHP 代码不被转售

javascript - 光标 :pointer not working on input type file