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

孝感風(fēng)信網(wǎng)絡(luò)科技有限公司微信公眾號

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

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

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

// 綁定手機(jī)號彈窗
    $(".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('請求錯(cuò)誤');
                }
            },
            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();
    });
欄目列表
推薦內(nèi)容
熱點(diǎn)內(nèi)容
展開