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. .
高洛峰2017-06-26 10:59:50
Determine whether the returned true or false
true executes ajax
false and closes the modal box
then it is ok.
给我你的怀抱2017-06-26 10:59:50
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...
给我你的怀抱2017-06-26 10:59:50
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.
为情所困2017-06-26 10:59:50
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.
怪我咯2017-06-26 10:59:50
It is recommended to use the layer plug-in, which is simple and convenient.
prompt example:
layer.open('Cloase?',{yes : function(){
}
},cancel : function(){
});