【发布时间】:2014-01-23 04:31:53
【问题描述】:
我正在尝试在单个页面中提交三个表单。但我停留在某一点上。 我想在第一个表格中验证手机号码。然后在最终表单提交中使用该手机号码
我已尝试在单个表单中使用此功能,但是如何发送 Web 请求以使用验证移动按钮发送验证密码。
我有这样的三种形式,
//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。
【问题讨论】:
-
使用本地存储或会话。
-
@CJRamki 本地存储你的意思是 html 或数据库中的标签?
-
您的意思是在使用 java 脚本提交的第一个表单上设置 cookie。好吧,我一定会尝试的
-
是的... cookie 中的第一个表单提交存储编号。并以另一种形式从 cookie 中获取价值并加以利用。完成所有工作后不要忘记删除 cookie w3schools.com/js/js_cookies.asp
-
@CJRamki 将其发布为答案。它确实帮助了我。我使用 Session 和 AJAX 从同一页面提交多个表单
标签: php jquery html ajax web-services