微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

js动态生成form 并用ajax方式提交的实现方法

Js代码

rush:js;"> var tempForm = document.createElement("form");   tempForm.action="http://localhost:8080/test/user";   tempForm.method="post";   document.body.appendChild(tempForm);         //create a submit button    var tempInput = document.createElement("input");   tempInput.type="hidden";   tempInput.name="method";    tempInput.value=methodName; //the parameter of method in the code of dispatchAction.     tempForm.appendChild(tempInput);      //submit the form   tempForm.submit();

Ext.Ajax.request({
form:'intPayForm',method:'post',success:function(data){
alert(data.responseText);
},failure:function(){
}
});

Ext 3中支持这种写法,其他版本尚未试过。

以上这篇js动态生成form 并用ajax方式提交的实现方法就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持编程之家。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐