spring mvc 接收ajax请求无法接收到数据
这是后台代码@Controller@RequestMappingpublicclassChatRecordsController{@RequestMapping("cha...
这是后台代码
@Controller
@RequestMapping
public class ChatRecordsController {
@RequestMapping("chat_records.do")
@ResponseBody
public String chatRecords(){
System.out.println();
System.out.println("接收ajax请求");
return "";
}
}
这是前端代码
$("#chat_input_from_get_wxy input").click(function(){
var chat_records = $("#chat_input_from_get_wxy textarea").val();
alert(chat_records);
$.ajax({
url:"chat_records.do",
type:"post",
date:{name:chat_records},
success: function(msg){
alert("保存成功");
},
error:function(msg){
alert("保存失败");
}
});
}); 展开
@Controller
@RequestMapping
public class ChatRecordsController {
@RequestMapping("chat_records.do")
@ResponseBody
public String chatRecords(){
System.out.println();
System.out.println("接收ajax请求");
return "";
}
}
这是前端代码
$("#chat_input_from_get_wxy input").click(function(){
var chat_records = $("#chat_input_from_get_wxy textarea").val();
alert(chat_records);
$.ajax({
url:"chat_records.do",
type:"post",
date:{name:chat_records},
success: function(msg){
alert("保存成功");
},
error:function(msg){
alert("保存失败");
}
});
}); 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询