<script>
if(status==0){
superscript="images/0.jpg";
btn="<button type='button' class='btn btn-primary btn_style' style='background: #09AD56' data-res='"+responsible_id+"' data-id='"+id+"' οnclick='receive(this)' >收到</button>"
}
function receive(a){
//var this=$(this);
console.log(a);
var res=$(a).attr("data-res"); //执行人id
var id=$(a).attr("data-id"); //任务id
var userInf=JSON.parse(localStorage.getItem('userInf')); //缓存获取用户信息
var token=userInf.token
//console.log(pro);
$.ajax({
type: "POST", // 请求方式
url: window.myTaskReceive, // 目标资源
data: {
responsible_id:res,
token:token,
executive_id:id
}, // 请求参数
//contentType: "multipart/form-data",
dataType:"json",// 服务器响应的数据类型
success : function (e) {
console.log(e)
//code: 0, msg: "接收任务成功", received: 1
if(e.code=="0"&&e.msg=="接收任务成功"&&e.received==1){
alert("成功接收任务!");
window.location.href = 'file:///C:/Users/Administrator/Desktop/任务/必点文件夹/必点新/force.html?n='+ Math.random();
}else{
alert("任务接收失败,请重新尝试!")
window.location.href = 'file:///C:/Users/Administrator/Desktop/任务/必点文件夹/必点新/force.html?n='+ Math.random();
}
}
})
}
</script>
input直接调用函数
最新推荐文章于 2023-07-15 14:01:46 发布