Submit complex format json data

[] The json representation at the beginning is list {} The representation at the beginning is a large json object, the control generally uses []
@RequestMapping(value = "/savetree")
    public String saveTree( @RequestBody List<MenuDto> menuDtos, @RequestParam( value = "roleId", required = false) String roleId) {

$.ajax({
            type: "post",
            url: "<%=webPath%>/system/acount/savetree.do?roleId="+roleId,
            data : JSON.stringify(events),
            dataType: "json",
            contentType: "application/json"
           
        });

=========================== =========
$(function() {

$("input[type='button']").unbind();
    $("input[type='button']"). bind("click",function(){
    var s1 =$("#s1").val();
    var s11 =$("#s11").val();
    var s2 =$("#s1").val();
    var s21 =$("#s21").val();
    var s3 =$("#s3").val();
    var s31 =$("#s31").val();
    var d1 =$("#d1").val();
    var d2 =$("#d2").val();
    var d3 =$("#d3").val();
    var checkda=s1+s11+d1+s2+s21+d2+s3+s31+d3;
  //  alert(s1);
   //alert(s11);
    alert(checkda);
    eventdata=[];//以【】开始的后台接收要list
   eventdata.push({
   id:1,
  logincodecheck:checkda
   });
   var d ={
   id:1,
  logincodecheck:checkda
   };
   //JSON.stringify(eventdata)
    $.ajax({

            type: "post",
            url: "<%=webPath%>/system/users/savecheck.do",
            data: JSON.stringify(eventdata),
            dataType: "json",
            contentType:"application/json",// Since it is []list, this
            success should be added at this time: function (data) {
                if (data = 1) {
                } else if (data = 0) {
                    alert("The operation failed, the record may no longer exist.");
                } else if (data > 1) {
                    alert("Error, multiple records were deleted.");
                }
            },
            error: function (textStatus) {
                alert("Data load failed!!!");
            }
});
  });
});

  @RequestMapping(value = "/savecheck")
    @ResponseBody
    public String saveCheck(@RequestBody List<User> user) {//由于前台是【】不是{}
    System.out.println("111");
        return "redirect:index.do";
    }

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326790186&siteId=291194637