问题
需要异步处理不同状态
1. onclick用法 if判断弹出窗口
注意..
<a href="javascript:void(0);" onclick="if(confirm('<?php echo "你确定要取消吗?";?>')){location.href='index.php?act=member_designer_task&op=task_close&tid=<?php echo $val['task_id'];?>';}else{return false;}">取消</a>
php代码
public function task_closeOp(){
$tid = intval($_GET['tid']);
$model = Model();
$where = array(
'task_id'=>$tid,
);
$data['task_status'] = 3;
$result = $model->table('designer_task')->where($where)->update($data);
if($result){
$url = array(array(
'url'=>'www.baidu.co',
'msg'=>'返回列表页', );
showMessage(L('nc_common_op_succ'),$url);
}else{
showMessage(L('nc_common_op_fail'));
} }
<a href="javascript:;" onclick="addrs_confirm({{addr_id}},{{def_addr}})">
<span id="addr_confirm" class="am-modal-btn" data-am-modal-confirm="">提交</span>
</a>
function addrs_confirm(addr_id,def_addr){
var member_id = $.app.data.userID();
data ="addr_id="+addr_id+"&member_id="+$.app.data.userID();
$.app.data.save($.app.dataapi.member_addr_del, data, function(data){
mui.toast(data.msg);
goto("checkout-checkout-address");
},function (data){
mui.toast(data.msg);
});
}