$.ajax({ async: false, type: "POST", url:'searchFileSource', contentType : "application/x-www-form-urlencoded; charset=utf-8", data: {"logicalId": logicalId}, dataType: "json", success: function (data) { jQuery("#SEND_SOURCE").empty(); jQuery("#SEND_SOURCE").append("<option value=''>请选择</option>"); for(var i=0;i<data.data.length;i++){ jQuery("#SEND_SOURCE").append("<option value='"+data.data[i].ID+"'>"+data.data[i].SOURCE_NAME+"</option>"); } } });
@PostMapping("/searchFileSource") public Result<Object> searchFileSource(String logicalId){ List<Map<String, Object>> fileSourceList = fileTaskService.findFileSource(logicalId); return ResultUtil.success(ResultEnum.SEARCH_SUCCESS, fileSourceList); }
但是报404,找不到searchFileSource.jsp,原因是因为这个类的注解写的是@Controller,应该用注解@RestController