js post方式提交表单有两种办法,1:AJAX提交 2:在JS里拼出一个form,然后submit
第二种办法的代码
//这个主要是解决给password MD5
var email = 'email';
var pwd = 'password';
var postForm = document.createElement("form");//表单对象
postForm.method="post" ;
postForm.action = 'login.jspx' ;
var emailInput = document.createElement("input") ; //email input
emailInput.setAttribute("name", "email") ;
emailInput.setAttribute("value", email);
postForm.appendChild(emailInput) ;
var pwdInput = document.createElement("input");// password input
pwdInput.setAttribute("name","password");
pwdInput.setAttribute("value",pwd);
postForm.appendChild(pwdInput);
document.body.appendChild(postForm) ;
postForm.submit() ;
document.body.removeChild(postForm) ;
分享到:
相关推荐
一、javascript 页面加裁时自动提交表单: Form表单: <form method="post" id="myform" action="a.php"> <input type="submit" value="提交表单"> </form> javascript 代码: [removed] ...
如下所示: form表单ID:postform 设置表单请求url document.postform.action = SaveReturnInfo...以上就是小编为大家带来的js 提交form表单和设置form表单请求路径的实现方法全部内容了,希望大家多多支持软件开发网~
通过js模拟post提交 1:请求需要的参数过长,超过get允许的最大长度 2:想要隐藏地址栏的参数 //新创建一个form表单 [removed]('<form name=myForm></form>'); var myForm=document.forms['myForm']; ...
博文链接:https://clarancepeng.iteye.com/blog/112040
该方法是解决前台页面中,在js中处理,实现post进行提交数据并跳转的方法。方法的主要思路是,在页面中创建一个隐藏的form表单,动态在form表单中添加不同的数据,最后将创建的form表单元素添加到页面中并隐藏,在...
在form表单上添加一个提交事件调用验证数据方法 <form name="listform" action="resume-doAdd" method="post" onsubmit="return Validator.Validate(this,3);"> 请输入正确的手机号!" requiremsg="移动电话不能为...
js提交from表单的内容,支持post提交,并可以返回提交状态或返回值。
JavaScript获取网页表单的提交方式是get还是post,获取提交方式可以通过表单的method属性获得 <!DOCTYPE html> <html> <body> <form id=frm1 action=form_action.asp method=get> First name:...
最普通最常用最一般的方法就是用submit type..看代码: 复制代码代码如下: <form name=”form” method=”post” action=”#”> <input type=”submit” name=”submit...第三种是使用链接来提交表单,用到了
页面跳转,提交参数 var form = new form_util.form({ url: uri, method: 'POST', target: '_self', params: param }); $(form).submit();
使用浏览器后退按钮重复之前的操作,导致重复提交表单。 使用浏览器历史记录重复提交表单。 浏览器重复的HTTP请求。 几种防止表单重复提交的方法 禁掉提交按钮。表单提交后使用Javascript使提交按钮disable。这种...
<span xss=removed><form action="/registOK" method="get"> ...input type="text" id="userName" name="userName"> ...input type="password" ...我写的注册表单,用post请求提交到registOK页面,提交后提示cannot
处理各种表单, 以及链接,按钮的通用组件 代码如下:/** * Generic Form processing js * @author Anthony.chen */ /** * Push button action [btn_action]data into form * If there is prescript , run the ...
昨天,在做一个表单异步提交内容的时候,遇到很奇怪的问题,submit()方法无法进行提交,每次提交都是把 当前给刷新了,网络抓包发现,每次都是 get方式去获取 当前页面,完全没有post 请求,想着以前 遇上这样的问题...
本文实例为大家分享了js防止表单重复提交实现代码,供大家参考,具体内容如下 <html> <BODY BGCOLOR=#FFFFFF> <form name='formsubmitf' id =the method=post action=XXX.php> <input ...
最近的一个项目中,需要通过 JavaScript 提交表单数据到另一个域名下的PHP接口(因为数据较大,需要HTTP POST方式提交),并获取PHP接口的返回值,在页面无刷新、无跳转的情况下,更新div标签内的内容。 浏览器...
通过post的方式提交表单到/reg,后台可以注册用户。 然后跳转到登陆页面/login。 2.get请求访问登陆页面/login, 输入用户名和密码,然后通过post方式提交表单到/login, 后台判断用户和密码是否正确,如果正确, 则...
当然,jquery可以实现异步提交表单,jquery.form.js这个库貌似也挺流行 只是有时候并不想使用额外的库,所以就琢磨着自己写,用纯js来实现异步提交表单 实现如下(本例用POST方式提交,用php作为服务器脚本) HTM L...
使用浏览器后退按钮重复之前的操作,导致重复提交表单。 使用浏览器历史记录重复提交表单。 浏览器重复的HTTP请求。 几种防止表单重复提交的方法 1.禁掉提交按钮。表单提交后使用Javascript使提交按钮disable。...