We do before and after the interaction, it may relate to the time of submission, receiving back-end data model time data type is Date type, so we have to give back-end pass to type Date, but user-friendly, and we tend to show the acquired data is formatted time format.
Model class:
Ajax transmission format:
$.ajax({
type: "post",
contentType: "application/x-www-form-urlencoded",
url: "/api/v1/****",
data: {
"ftime": new Date(ftime),
"title": title,
"content": content,
"ltime": new Date(ltime),
},
dataType: "json",
success: function (data) {
if (data.resultTypeEnum == 200) {
layer.msg(data.message, {icon: 1})
clearhomework();
} else {
layer.msg(data.message, {icon: 2})
}
}
});
Here to do a simple operation, the time is then transferred to a Date type.