这里有检查方法很详细,如果方法没问题,不妨看看后台报什么错,检查下接口是否有问题;
https://blog.csdn.net/Q_AN1314/article/details/53405580
我说说我当时遇到的问题:
我当时是将SystemConfigEntity 这个实体类给转化成json,这里犯了一个严重错误,即:
public String getVersion(@RequestBody SystemConfigEntity systemConfigEntity)
正确的写法应该是:
$.ajax({
url: ctx_root + '/version/list',
type: 'post',
contentType: 'application/json;charset=utf-8',
dataType: 'json',
data: JSON.stringify(param),
success: function (result) {
$("#version").html(result.value);
}
后台接口:
/**
* 云平台版本
*/
@Controller
@RequestMapping(value = "/version")
public class VersionController {
@Autowired
private SystemConfigDubboService systemConfigDubboService;
@RequestMapping(value = "/list",method = RequestMethod.POST)
@ResponseBody
public SystemConfigEntity getVersion(@RequestBody SystemConfigEntity systemConfigEntity){
SystemConfigEntity config = systemConfigDubboService.getSystemConfigField(systemConfigEntity.getField());
return config;
}
}