dongzou9047 2014-11-07 13:54
浏览 54

如何改变jQuery验证的远程方法响应

I need to validate a phone number through remote method from validation, but also the response i get is not true/false and the form doesn't validate. It is possible to alter the reponse after i use the parameter which is returned?

remote: {
                url: "index.php/main/verifyphone",
                type: "post",
                data: {
                    phone: function() {
                        return $("#PHONE").val();
                    },
                    product: function() {
                        return $("#choose").chosen().val();
                    }                        
                },
                complete: function(response) {
                    if (response.responseJSON!=false) {
                        $("#GUID").attr('value', response.responseJSON);
                        return true;
                    } else {
                        return false;
                    }                        
                }                    
            }

In this form, the response is treated as a custom message for failure. I need to transform the response to TRUE, after i save the responseJSON, so my form can validate. Any ideas? PS: The response from php can be false or an number. If it is a number, validate the form.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 素材场景中光线烘焙后灯光失效
    • ¥15 请教一下各位,为什么我这个没有实现模拟点击
    • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
    • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
    • ¥20 有关区间dp的问题求解
    • ¥15 多电路系统共用电源的串扰问题
    • ¥15 slam rangenet++配置
    • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
    • ¥15 ubuntu子系统密码忘记
    • ¥15 保护模式-系统加载-段寄存器