0712-2888027 189-8648-0214
微信公眾號

孝感風信網絡科技有限公司微信公眾號

當前位置:主頁 > 技術支持 > Javascript/JQuery > Ajax請求綁定手機號彈窗實現(xiàn)的代碼片段

Ajax請求綁定手機號彈窗實現(xiàn)的代碼片段

時間:2024-09-17來源:風信官網 點擊: 692次
Ajax請求綁定手機號彈窗實現(xiàn)的代碼片段,以下代碼為項目開發(fā)中的片段,實現(xiàn)方法思路僅供參考。

// 綁定手機號彈窗
    $(".get-phone").on("click", ".c-btn,.close,.phone-bg", function () {
        $(".get-phone").hide();
    });
    /**
     * ajax方法封裝
     * @param url
     * @param data
     * @param type
     * @param success
     * @param error
     * @param beforeSend
     * @param async
     */
    var ajax = function (url, data, type, success, error, beforeSend, async) {
        $.ajax({
            url: url,
            data: data,
            dataType: 'JSON',
            type: type,
            success: function (res) {
                layer.closeAll();
                success(res);
            },
            error: function () {
                if (typeof error === 'function') {
                    error();
                } else {
                    layer.msg('請求錯誤');
                }
            },
            beforeSend: function () {
                if (typeof beforeSend === 'function') {
                    beforeSend();
                } else {
                    var index = layer.load(1, {
                        shade: [0.1, '#fff'] //0.1透明度的白色背景
                    });
                }
            }
        });
    };

    $('#registerBtn').on('click', function () {
        $('#registerModal').removeClass('hide');
    });
    //隱藏模態(tài)框
    $('span[data-bind-bs="hideModal"]').on('click', function () {
        var _this = $(this);
        _this.parents('div.hkt-win').addClass('hide');
    });

    $('.show-input > span').click(function () {
        $('.show-input').hide();
        $('.nav').fadeIn(800);
        $('.click-seek').show();
    });
欄目列表
推薦內容
熱點內容
展開