layui弹出层表单不显示后台数据的值,data中是有值的的可是在弹出层表单中不显示,这问题该怎么解决,求助求助!!!
function editStudent(obj,s_id) {
$.ajax({
url:"/findStudentById",
type:"get",
dataType:'json',
data:{"s_id":s_id},
success:function (data) {
layer.open({
type:1,
title:"修改信息",
skin:"updateCss",
area:["50%"],
anim:2,
content:$("#updteDiv").html(),
});
$("#s_studentid").val(data.s_studentid);
$("#s_name").val(data.s_name);
$("#s_sex").val(data.s_sex);
$("#s_age").val(data.s_age);
$("#s_phone").val(data.s_phone);
$("#s_classid").val(data.s_classid);
$("#s_studentid").val(data.s_dormitoryid);
console.log(data.s_dormitoryid);
console.log( $("#s_studentid").val());
console.log( $("#s_studentid").val(data.s_dormitoryid));
}
});
}
conso.log出来的结果
301
301
Object { 0: input#s_studentid.layui-input, length: 1, context: HTMLDocument http://localhost:8080/findStudent, selector: "#s_studentid" }
Controller里的方法
@RequestMapping( "/findStudentById")
@ResponseBody
public Student findStudentById(Integer s_id) {
Student s= studentService.findStudentById(s_id);
return s;
}