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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T04:52:53+00:00 2026-05-31T04:52:53+00:00

I have a strange behaviour in my ajax posting. First, I display an anchor

  • 0

I have a strange behaviour in my ajax posting. First, I display an anchor link with the class ‘remove-link’. From this link, I get the target URL in the variable removeLinkObj. Next, I show a jquery ui dialog to ask the user to confirm. Then I do the ajax call with the url removeLinkObj.

The problem is that in STEP1 the link is (for example) ../../43 and in STEP2 the link is ../../42. So it is the previous value! Why is the value not the right one? I don’t know if I’m clear?

The aim of my code is to ask confirmation to the user (through a jquery ui dialog) before posting.

$().ready(function () {

var removeLinkObj;

$('.remove-link').click(function () {
    // STEP1
    removeLinkObj = $(this);  //for future use
    $('#confirm-remove').dialog('open');
    return false; // prevents the default behaviour
});

$('#confirm-remove').dialog({
    autoOpen: false, width: 500, resizable: false, modal: true,
    buttons: {
        "Continue": function () {
            // STEP2
            $.ajax({
                type: "Delete",
                url: removeLinkObj[0].href,
                cache: false,
                success: function (data) {
                    alert(data.TransportedMaterialId);
                    $("#" + data.TransportedMaterialId).remove();
                }
            });
            $(this).dialog("close");
        },
        "Cancel": function () {
            alert('User clicked Cancel');
            $(this).dialog("close");
        }
    }
});

})

And in my html:

<a href="aa/bb/44" class="remove-link">Delete</a>

Thank you anyway.

  • 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-31T04:52:55+00:00Added an answer on May 31, 2026 at 4:52 am

    you can pass a parameter to your dialog instead of using global data. Before calling $('#confirm-remove').dialog('open')
    add $('#confirm-remove').data('href', <get your href>);
    and in you step 2 you can get the href:

     $(this).data('href');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have strange behaviour in Python/PyMongo. dbh = self.__connection__['test'] first = dbh['test_1'] second =
I have very strange behaviour of Java Date class: System.out.println(new Date().toGMTString()); long l =
Why this two functions have the strange behaviour of when I click on thead,
I have a strange behaviour when autowiring I have a similar code like this
I have this strange behaviour in VS2010 where any modifications I make to keyboard
I have this strange behaviour in IE9 where, when I change the border-color of
I have this function $.ajax({ url: aurl, method: 'GET', beforeSend: function (req) { req.setRequestHeader('Authorization',
I have a strange behaviour, maybe I'm missing something. I have this DOM element
This is a very strange behaviour. If I have something like this (time interval
I have some strange behaviour going on with the jQuery ajax functionality in my

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.