第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

如何防止在jQuery中多次加載文件

如何防止在jQuery中多次加載文件

SMILET 2022-05-26 14:51:59
可能我這個(gè)線程的主題與stackoverflow上的多個(gè)線程相同,但請(qǐng)相信我,我已經(jīng)閱讀了這個(gè)平臺(tái)和谷歌上的所有線程,但我沒有得到下面問題的預(yù)期答案 - 當(dāng)我點(diǎn)擊按鈕時(shí)第一次模態(tài) div 正確加載 URL,但在關(guān)閉模態(tài) div 并點(diǎn)擊按鈕再次打開后,它會(huì)加載兩次。表示在每個(gè)按鈕單擊模式加載 URL 兩次之前的加載 URL。假設(shè)這次 LOAD URL 加載 2 次,下次加載 4 次,依此類推。甚至,我用過return false但我沒有得到答案,我也閱讀了其他線程的答案,但它與我的問題代碼不匹配。注意:請(qǐng)我是 stackoverflow 政策的規(guī)則,在閱讀所有線程后不做這個(gè)線程,然后沒有得到答案,請(qǐng)不要標(biāo)記這個(gè)重復(fù)/未決和任何負(fù)面標(biāo)記。我在代碼中做錯(cuò)的地方是我在這個(gè) Debug 中的新手。$('#reveal_AddSenderMod').on('click', function() {  $('.modal.fade.modal-style2').on('shown.bs.modal', function() {    $(this).find('.modal-body').find('#loadURL').load('./loadPage.html').fadeIn('slow');    return false;  });})<link rel="stylesheet" href="http://shashani-humanth.github.io/Notebook-AdminPanel/css/bootstrap.css" type="text/css" /><button type="button" id="reveal_AddSenderMod" data-toggle="modal" data-target="#modal-style2" style="width:75px; display: block;margin: 0 auto;" data-keyboard="false" data-backdrop="static">OPEN MODEL</button><div class="modal fade modal-style2 hidden-print" id="modal-style2" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">  <div class="modal-dialog">    <div class="modal-content">      <div class="modal-header"></div>      <div class="modal-body">        <div class="row">          <div id="loadURL" class="animated fadeIn"></div>          <button data-dismiss="modal">CLOSE MODEL</button>        </div>      </div>    </div>  </div></div><script> $(document).on("click", "button[data-dismiss='modal']", function(e){  e.preventDefault();  $('div.modal-body').find('div#loadURL').find('div.senderIDAdd_module').empty(); //remove() is also not works }); </script><script src="http://shashani-humanth.github.io/Notebook-AdminPanel/js/jquery.min.js"></script><!-- Bootstrap --><script src="http://shashani-humanth.github.io/Notebook-AdminPanel/js/bootstrap.js"></script>
查看完整描述

1 回答

?
慕田峪7331174

TA貢獻(xiàn)1828條經(jīng)驗(yàn) 獲得超13個(gè)贊

您正在綁定事件多時(shí)間。


單擊時(shí),您應(yīng)該只打開模式。不綁定。綁定應(yīng)該做一次。


$('#reveal_AddSenderMod').on('click', function() {

  $('.modal.fade.modal-style2').modal('show');

})


$('.modal.fade.modal-style2').on('shown.bs.modal', function() {

    $(this).find('.modal-body').find('#loadURL').load('./loadPage.html').fadeIn('slow');

    return false;

  });

//一些偽代碼


$('body').on('click', '#on-submit-senderid', function() {

        if(localStorage.getItem("review_submitte")) {

          return;

        }

        if(!$('input[name="sender_id_confirm"]').is(':checked')) {

            mkNoti(['Ops!'],['Please agree the condition to get Custom Sender ID'],{ sound: true, status:['danger'],dismissable:?false });

            return;

        } else {

            $.ajax({

                            ...

                success: function(response) {

                    if (response.status == 'success') {

                        //SUCCESS

                        return false;

                    } else {

                        mkNoti([response.title],[response.message],{ sound: true, status:[response.status],dismissable:?false });

                        return false;

                    }

                    localStorage.setItem("review_submitte", "true")

                }

            });

            hide_loader();

            return false;

        }

    });


查看完整回答
反對(duì) 回復(fù) 2022-05-26
  • 1 回答
  • 0 關(guān)注
  • 144 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)