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

作者:jingxian 时间:2024-04-17 09:59:54 

Js代码:


vartempForm=document.createElement("form");  
tempForm.action="http://localhost:8080/test/user";  
tempForm.method="post";  
document.body.appendChild(tempForm);  

//createasubmitbutton  
vartempInput=document.createElement("input");  
tempInput.type="hidden";  
tempInput.name="method";  
tempInput.value=methodName;//theparameterofmethodinthecodeofDispatchAction.  

tempForm.appendChild(tempInput);  
//submittheform  
tempForm.submit();  

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

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

标签:jquery,ajax,提交,form
0
投稿

猜你喜欢

  • 一文详解golang延时任务的实现

    2024-03-23 16:00:16
  • python3实现mysql导出excel的方法

    2024-01-20 17:57:58
  • python 写的一个爬虫程序源码

    2022-08-10 16:00:47
  • MySQL数据库基于sysbench实现OLTP基准测试

    2024-01-28 11:07:14
  • 对python3 urllib包与http包的使用详解

    2022-08-04 15:20:14
  • vue $mount 和 el的区别说明

    2024-04-28 09:20:24
  • 为导入文件加上时间戳标记的两种方法

    2009-01-07 14:14:00
  • Numpy 数组操作之元素添加、删除和修改的实现

    2023-06-23 22:09:03
  • python2.7 json 转换日期的处理的示例

    2021-02-10 12:39:50
  • 详解vue-router和vue-cli以及组件之间的传值

    2024-05-21 10:31:10
  • SQLite5-使用Python来读写数据库

    2024-01-15 23:44:08
  • 浅谈Pandas Series 和 Numpy array中的相同点

    2022-06-11 15:20:17
  • keras多显卡训练方式

    2022-05-01 02:50:21
  • Python实现文字pdf转换图片pdf效果

    2021-03-10 23:20:03
  • MySQL操作并使用Python进行连接

    2024-01-25 00:54:56
  • Python远程SSH库Paramiko详细操作

    2022-08-14 18:38:09
  • js获取 type=radio 值的方法

    2024-04-29 13:18:38
  • python四种出行路线规划的实现

    2022-10-01 18:46:09
  • VS自带的SQL server修改密码并连接使用

    2024-01-27 17:02:12
  • 使用百度云加速后网站打开速度慢、广告不显示的解决方法

    2023-04-23 19:07:24
  • asp之家 网络编程 m.aspxhome.com