联系官方销售客服

1835022288

028-61286886

POSCMS 版主:POSCMS负责人
Ajax修改数据状态的js写法
类型:POSCMS 更新时间:2021-06-25 14:29:37 文章

请教一个问题  我在表单中 设置一个 状态提交,该怎么写js

wap上用ajax提交

数据表是 services_form_ydfw 

要修改的是 服务状态 fwzt

默认0 待接单  1已接单 2待打赏 3已完成

我复制了系统文章默认的关闭和打开状态 js  。但不知道该怎么改成我需要的


<script type="text/javascript">


    function dr_form_fwzt(id, v) {
        var title = "";
        if (v == 0) {
            title = "<font color=red><b>{fc_lang('您确定要接单吗?')}</b></font>";
        } else if (v == 1){
            title = "<font color=blue><b>{fc_lang('您确定已完成吗?')}</b></font>";
        } else if (v == 2) {
            title = "<font color=blue><b>{fc_lang('您确定要打赏吗?')}</b></font>";
} else {
            title = "<font color=blue><b>{fc_lang('本次服务已经结束,下次再见!!')}</b></font>";
        }
        var d = top.dialog({
            title: lang["tips"],
            fixed: true,
            content: '<img src="/statics/js/skins/icons/question.png"> '+title,
            okValue: lang['ok'],
            ok: function () {
                // 将表单数据ajax提交验证
              $.ajax({type: "POST",dataType:"json", url: "{dr_member_url(MOD_DIR.'/mform/status')}&id="+id+"&v="+v, success: function(data) { 
  
   
                        //验证成功
                        if (data.fwzt == 1) {
                            dr_tips(data.code, 3, 1);
                            if (data.id) {
                                $.ajax({
                                    type: "POST",
                                    dataType:"jsonp",
                                    url:"{$html_url}c=show&m=create_html&id="+id,
                                    success: function(data) { },
                                    error: function(HttpRequest, ajaxOptions, thrownError) { }
                                });
                                $.ajax({
                                    type: "POST",
                                    dataType:"jsonp",
                                    url:"{$html_url}c=show&m=create_list_html&id="+data.id,
                                    success: function(data) { },
                                    error: function(HttpRequest, ajaxOptions, thrownError) { }
                                });
                            }
                            setTimeout('window.location.reload(true)', 3000); // 刷新页
                        } else {
                            dr_tips(data.code);
                        }
                    },
                    error: function(HttpRequest, ajaxOptions, thrownError) {
                        alert(HttpRequest.responseText);
                    }
                });
                return true
            },
            cancelValue: lang['cancel'],
            cancel: function () {}
        });
        d.show();
    }
</script>

现在不知道怎么修改,请帮我一下,谢谢