ajax提交form表单,关键代码:$("#theForm").serialize(
发布时间:2020-12-16 00:25:16 所属栏目:百科 来源:网络整理
导读:原始ajax提交: $.ajax({type: "POST",data:"processId="+$("#processId").val()+"delstepids="+delstepids,url: "./delStepForProcess.jspx",dataType: "text",cache: false,success: function(data){if(1==data){alert("删除失败!");return;}else{location
原始ajax提交: $.ajax({ type: "POST",data:"processId="+$("#processId").val()+"&delstepids="+delstepids,url: "./delStepForProcess.jspx",dataType: "text",cache: false,success: function(data){ if(1==data){ alert("删除失败!"); return; }else{ location.reload(); } } }); data:"参数1="+参数值
ajax提交form: $.ajax({ type: "POST",data:$("#theForm").serialize(),url: "${basePath}/public/sjkf/serveyanswer/saveData.jspx",success: function(data){ if(1==data){ alert("删除失败!"); }else{ } } }); data:$("#form的id").serialize()
action(或者controller)中接受参数: request.getParameter("token"); 返回信息: PrintWriter out = null; try { response.setCharacterEncoding("UTF-8"); response.setContentType("text/json;charset=UTF-8"); out =response.getWriter(); customProcessService.modifyStepToStart(processId,stepId); out.println("0"); } catch (Exception e) { out.println("1"); e.printStackTrace(); }finally{ if(out!=null){ out.close(); } } <form action="" id="theForm" name="theForm" enctype="multipart/form-data" method="post" >
</form>
----------------------------------------------------------------------------------------------------------------------- 不能认怂..................... (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |