AJAX异步提交form表单
来源:互联网 发布:呱呱漫画软件 编辑:程序博客网 时间:2024/05/16 16:56
记录:
网上有说怎么做,没说怎么接收,打印了一下数据,记录一下取值:
比如说有如下form:
form
<form id="form1" name="form1" action="" method="post">
<input type="hidden" name="submitTime" value="${now }">
<input type="hidden" name="receiverId" value="${receiverID }">
<input type="hidden" name="isRegister" value="${isRegister }">
</form>
发送异步请求提交form
function save(){
$.ajax({
url:'debt/saveNew.do'+'?t='+Math.random(),
data:$('#form1').serialize(), //将表单数据序列化,格式为name=value
type:'POST',
dataType:'json',
success:function(data){
//success
},
error:function(){
console.log("提交ajax函数异常");
},
});
}
获取(能从param中取到值意味着怎么接收都可):
@RequestMapping(value = "saveNew")
//@Token(remove=true)
public void saveNew(
HttpServletRequest request,HttpServletResponse response){
response.setContentType("application/json; charset=UTF-8");
try {
String submitTime = request.getParameter("submitTime");
String receiverId = request.getParameter("receiverId");
String isRegister = request.getParameter("isRegister");
- ajax 异步提交form表单
- ajax 异步提交form 表单
- AJAX异步提交form表单
- servlet3.0以上form表单提交(ajax异步提交)
- 异步提交form表单
- ajax异步提交form
- ajax提交form表单
- ajax提交form表单
- ajax 提交form表单
- ajax提交form表单
- ajax提交form表单
- Ajax提交form表单
- ajax提交form表单
- ajax 提交form表单
- ajax提交form表单
- Ajax提交form表单
- ajax提交form表单
- Ajax提交Form表单
- 双向链表的建立和打印
- Spring Boot 使用 Druid 和监控配置
- Microsoft SQL Server 2016 下载地址和密钥
- 【转载+补充】嵌入式内存泄露处理方法
- 西电渣硕面试经历
- AJAX异步提交form表单
- Json的序列化与反序列化
- 使用移动数组下标的方式实现增删改查
- Callable、FutureTask中阻塞超时返回的坑点
- 知乎上对理解阻塞非阻塞与同步异步的有趣解释
- 向量外积的应用
- 类与对象(1)
- Tomcat 源码阅读(五)解析请求ProtocolHandler
- 将<select>被选中项的值通过<a>链接的参数形式传递给后台的实现方法