php – html中单页的多个Web服务请求
发布时间:2020-12-13 16:52:24 所属栏目:PHP教程 来源:网络整理
导读:我想在单页中提交三个表单.但我坚持一点. 我想在第一张表格中验证手机号码.然后在最终表格提交中使用该手机号码 我已经尝试在单个表单中使用它但是然后我如何发送Web请求以发送验证引脚和验证移动按钮. 我有三个这样的形式, //First Form Take Mobile Number
我想在单页中提交三个表单.但我坚持一点.
我想在第一张表格中验证手机号码.然后在最终表格提交中使用该手机号码 我已经尝试在单个表单中使用它但是然后我如何发送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. 解决方法
您可以使用cookie或会话来完成此任务.
如果你只想用javascript做,你可以使用cookies.你可以从w3schools获得最好的参考 您可以使用像php这样的服务器端脚本并使用ajax. Cookie或会话中的第一个表单提交商店编号.并以另一种形式从cookie或会话中获取该值并使用它. 注意:完成所有工作后,请不要忘记删除cookie或会话. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |