您好,欢迎来到 速建时代开源商城!
v4.2表单提交-留言
web制作教程

148

<script>

    function doreg1() {
        var name = $('#name').val();
        var phone = $('#phone').val();
        var text = $('#text').val();
        var type = $('#type').val();
        var dizhi = $('#dizhi').val();

        $.ajax({
            type: 'POST',
            dataType: 'json',
            data: {name:name,phone:phone,text:text,type:type,dizhi:dizhi},
            url:"{:url('index/Phone/index')}",
            success: function(res){ //成功
                if (res.code==0){
                    alert(res.msg);
                       $("#name").attr("value","");
                     $("#phone").attr("value","");
                     $("#text").attr("value","");

                }
                if (res.code==1){
                    alert(res.msg);
                      $("#name").attr("value","");
                     $("#phone").attr("value","");
                     $("#text").attr("value","");

                }
            }
        });
    }
</script>