Home > Article > Web Front-end > nui form submission (compatible with ajax and form submit)
Page:
<form id="form1" method="post">
Multiple form items
</form> js: ajax: var form = new nui.Form("form1"); var data = form.getData(true, false); var json = nui.encode(data); //序列化成JSON nui.ajax({ url: "逻辑流或页面", type: "post", data: { submitData: json }, success: function (text) { alert("提交成功,返回结果:" + text); } }); form表单提交: var form document.getElementById("form1"); form.action = "页面或页面流"; form.submit();
The above is the detailed content of nui form submission (compatible with ajax and form submit). For more information, please follow other related articles on the PHP Chinese website!