Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8328003
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T01:18:03+00:00 2026-06-09T01:18:03+00:00

I am using js confirmation. I want to make it more beautiful with jquery

  • 0

I am using js confirmation. I want to make it more beautiful with jquery UI.

Using js confirmation:

$("a.delete").click(function() {
    el = $(this);
    if (confirm("Are you sure you want delete the data?")) {
        $.ajax({
            url : $(this).attr("href"),
            type : "GET",
            dataType : 'json', //The requested response in JSON format
            success : function(response) {
                if (response.status == 1) {
                    loadData();
                    $("#divFormContent").load("ajax.php?module=test&action=form_test");
                    $("#divFormContent").hide();
                    $("#btn_hide").hide();
                    // alert("The data successfully deleted!");
                } else {
                    alert("Data failed in the clearing!");
                }
            }
        });
    }
    return false;
}); 

Can anybody tell me how can I change it using jquery UI confirmation?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T01:18:06+00:00Added an answer on June 9, 2026 at 1:18 am

    First, you need to create the element which will be displayed. Sample html:

    <div id="dialog-confirm" title="Confirmation">
        <p><span class="ui-icon ui-icon-alert" style="float:left; margin:5px 7px 20px 0;"></span>Are you sure?</p>
    </div>
    

    The element will be automatically hidden when you call .dialog() on it passing the autoOpen: false parameter. Do it inside the DOM ready handler preferably.

    jQuery UI’s dialog boxes are asynchronous, they won’t freeze the function and wait for a response as the confirm prompt does. Instead, you have to wrap your function inside the “Yes” confirmation button’s callback.

    When you need the dialog then, just call $("#dialog-confirm").dialog("open");.

    And to finish, this will no longer reference the clicked element when you move your function from the click handler to the dialog’s callback handler. I used .data to store the clicked $(this).attr('href') in the #dialog-confirm‘s data and retrieve it for the Ajax call.

    Here’s the code:

    $(function() {
        $("a.delete").click(function() {
            $('#dialog-confirm').data('clickedHref', $(this).attr('href'));
            $("#dialog-confirm").dialog("open");
            return false;
        });
    
        $("#dialog-confirm").dialog({
            autoOpen: false,
            resizable: false,
            modal: true,
            buttons: {
                "Yes": function() {
                    $.ajax({
                        url : $('#dialog-confirm').data('clickedHref'),
                        //rest of your function here
                    });
                    $(this).dialog("close");
                },
                "No": function() {
                    $(this).dialog("close");
                }
            }
        });
    });
    

    jsFiddle

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i want to have function like delete file from database by using link instead
I am showing delete confirmation box using jQuery UI dialog. But on delete I
I am using Jconfirm together with jQuery to make a confirmation box. The problem
I want to implement delete confirmation dialog using FancyBox. The scenario is to pass
I want Yes and No buttons on a confirmation box without using jQuery UI
I want to encrypt some data in a form using jQuery before it's sent
I was trying to delete a data from database using jquery and the following
I am using jQueryUI to make a confirmation popup to save. I am writing
I need confirmation of my approach for this, I'm using EF and ASP.NET MVC
I would like a little confirmation that I'm doing this correctly. Using rails single

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.