简体   繁体   中英

Can't understand how to do it with javascript and jquery code

Sorry guys for asking that dumb question but I have problem with that thing. Have such script, it should return true or false, but after drawing that html pop-up window and getting response from that methods.

           $("#pageInfo a.btnDel").click(function () {

                    $("#cmsSmallPopUpWindowMessage").html("<h2>Do you really want to delete this page?</h2><center><div style='width:130px'><ul class='bactions'><li><a id='cmsSmallPopUpWindowBYes' href='javascript:void(0)'><span><span>Yes</span></span></a></li><li><a id='cmsSmallPopUpWindowBNo' href='javascript:void(0)'><span><span>No</span></span></a></li></ul><div class='archor'></div></div></center>");
                    $.blockUI({ message: $("#cmsSmallPopUpWindow"), css: { width: "530px", border: "0px", backgroundColor: "transparent"} });
                    setTimeout(function () {
                        $.unblockUI();
                    }, 6000);


                    $("#cmsSmallPopUpWindowBNo").click(function () {
                        $.unblockUI();
                        return false;
                    });


                    $("#cmsSmallPopUpWindowBYes").click(function () {
                        $.unblockUI();
                        location.reload();
                        return onDelete($(this).attr('href'));
                    });
                    return true; // this should change for "false" or "true" but after click on "yes" or "no" 


                });

I would suggest to use the jQueryUI modal-confiramtion dialog . It just fits your needs, blocks the UI (modal), has a nice layout and works assync (not freezing the script).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM