function getUnixTime(dateStr){
var newstr = dateStr.replace(/-/g,'/');
var date = new Date(newstr);
return date
}
var dt = getUnixTime('2021-4-4');
if (dt.getDay() % 6 == 0){
console.log("周末");
}else{
console.log("工作日");
}
$.ajax({
type: "get",
url: "http://api.djapi.cn/wannianli/get",
data:{
date:"2021-04-07",
token:"申请的token"
},
dataType: "json",
contentType: "application/x-www-form-urlencoded;charset=utf-8",
async: true,
success: function (data) {
console.log(data)
},
error: function (data) {
}
})
输出数据格式: