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 7627615
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T05:28:58+00:00 2026-05-31T05:28:58+00:00

i have the following ajax.actionlink:- @Ajax.ActionLink(Delete, Delete, Answer, new { id = answer.AnswersID },

  • 0

i have the following ajax.actionlink:-

@Ajax.ActionLink("Delete", "Delete", "Answer",
    new { id = answer.AnswersID },
      new AjaxOptions
      {
          OnBegin = "deleteconfirmation1",
          HttpMethod = "Post",
          UpdateTargetId = @answer.AnswersID.ToString(),
          OnSuccess = "deleteconfirmation",

      })

and the following deleteconfirmation1.js that should display a confirmation message before executing the ajax call:-

function deleteconfirmation1() {
jConfirm('Deletion Confirmation', 'Are you sure you want to delete this Answer');
}

the problem that i am facing is that the onbegin confiramtion will not prevent the onsuccess script from being executed even if the user click on the cancel button? so how i can make the OnBegin to work as a confirmation stage, so the application will wait for the user selection either “Ok” or “cancel” before processding with the ajax call or not !!! ??
BR

  • 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-05-31T05:28:59+00:00Added an answer on May 31, 2026 at 5:28 am

    You need return false from the OnBegin method to cancel the request.

    Note that Ajax.ActionLink already supports confirmation with the AjaxOptions.Confirm property.

    You also need to include ~/Scripts/jquery.unobtrusive-ajax.js in your view/layout to use the @Ajax. helpers.

    EDIT issue with jConfirm:

    Your problem is that the signature of jConfirm is the following:

    void jConfirm(message, [title, callback])
    

    It’s instead of returning true/false expects a callback function which is called when the user clicked on ok/cancel.

    This causes the problem because you need to return false from the OnBegin but you don’t have a return value from jConfirm just in the callback…

    So you should wait for the callback…. see this SO question Can you wait for javascript callback?
    (which is also about jConfirm) for more information.

    The conclusion is that you cannot use jConfirm to cancel the request with the OnBegin method.

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

Sidebar

Related Questions

i have the following ajax.actionlink :- <div id =link> @Ajax.ActionLink(Add New Answer, Create, Answer,
i have the following Ajax.actionlink inside a view to add an answer under a
I have the following @Ajax.ActionLink code: @Ajax.ActionLink(Assign Ownership, AssignOwnership, new { techLogCode = Model.TechLog.Code,
i have the following javascript to post a form through ajax without refreshing the
Hi I have the following code with jQuery: function reject(id) { $.ajax({ type: 'POST',
I have the following ajax.actionlink. i want to add click event to this actionlink.
I have the following Ajax call: function ajaxCall(soap, url){ // Post SOAP request. $.ajax({
I have the following ajax as you see below: $.ajax({ url: url, type: 'POST',
I have the following jQuery Ajax call: $.ajax({ type: POST, url: addtobasket.php, data: sid=<?=
I have the following jQuery/ajax script: jQuery(input.button).click(function(){ jQuery.ajax({ url: 'addfav.php', type: 'POST', data: {'id':jQuery(this).closest(div).attr(id),is_ajax:

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.