js动态生成form 并用ajax方式提交的实现方法
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中支持这种写法,其他版本尚未试过。
相关推荐
wcqwcq 2020-07-04
TONIYH 2020-06-11
Qc 2020-07-19
swiftwwj 2020-07-05
yhginny 2020-04-20
nicepainkiller 2020-05-12
苦咖啡flask 2020-05-09
xinjing0 2020-05-08
Lius 2020-05-05
ajaxtony 2020-05-04
bcbeer 2020-04-23
sicceer 2020-04-20
cmsmdn 2020-02-18
longshengguoji 2020-02-13
ajaxtony 2020-02-03
ELEMENTS爱乐小超 2020-01-17
waterv 2020-01-01