javascript - When you click delete, a prompt box will be prompted to confirm whether to delete. After clicking OK, the ajax event will be executed. How to implement this?
淡淡烟草味
淡淡烟草味 2017-06-26 10:57:50
0
6
1367

Click delete, and a prompt box (modal box) will be prompted to confirm whether to delete. After clicking OK, the ajax event will be executed. How is this implemented?

I am new to front-end content, and the source code for the implementation of this pop-up box has not been found.

delete

is a pop-up box with fixed style through class="js-ajax-dialog-btn".

Searched for two pieces of jquery code $(.js-ajax-dialog-btn").... Even if it is blocked, there will still be a pop-up box.

The ideas of the bosses are very good, thank you!

Because the cache is too powerful, the code I found is correct and I changed the source code. .

淡淡烟草味
淡淡烟草味

reply all (6)
ringa_lee

Confirm Yes or No to execute ajax!

    小葫芦

    Determine whether the returned true or false
    true executes ajax
    false and closes the modal box
    then it is ok.

      给我你的怀抱

      If you don’t pursue results, just

      var result=confirm("是否删除?"); if(result==true){//do something}

      If you want something beautiful, look for various UI libraries and you will find this, for example
      https://ethaizone.github.io/B...

        给我你的怀抱

        When you click delete, only bind the event of the pop-up prompt box. In the pop-up box, bind the event for the confirmation button and make the corresponding ajax request.

          为情所困

          When you click delete, a modal box pops up, and then bind the ajax event to the confirmation button, then you can click OK to execute asynchronously.

            刘奇

            It is recommended to use the layer plug-in, which is simple and convenient.
            prompt example:

            layer.open('Cloase?',{yes : function(){ } },cancel : function(){ });
              Latest Downloads
              More>
              Web Effects
              Website Source Code
              Website Materials
              Front End Template
              About us Disclaimer Sitemap
              php.cn:Public welfare online PHP training,Help PHP learners grow quickly!