Switch language
zh
Switch theme
Light

jQuery-AJAX-提交表单信息时,提交按钮不能为-submit

ajax代码:

<script>
    jQuery("#btn").click(function () {
        jQuery.ajax({
            type: 'POST',
            url: "<{:url('admin/admin/update')}>",
            data: jQuery("form").serialize(),
            dataType: 'json',
            success: function (data) {
                if (data.status == 1) {
                    alert(data.message);
                    // window.location.href = "<{:url('admin/index')}>";
                } else {
                    alert(data.message);
                    // window.location.href = "<{:url('admin/edit')}>";
                }
            }
        })
    });
</script>

html文件可以是:

<input type="button" id="btn0" value="保存">
<button type="button" id="btn1">保存</button>
<a>保存</a>
🍀