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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T14:52:51+00:00 2026-05-13T14:52:51+00:00

I have several links that points to a single AJAX url. I can load

  • 0

I have several links that points to a single AJAX url. I can load it into a single #DIV, for each request with patterns: load and remove for each link. Now since all I need is a single url, I am trying to avoid removal and re-request procedure.

I have two scenarios, still questioning and badly need suggestions to also handle them:

  1. Create different container #DIVS so they won’t conflict when loading this single url into each DIV and proceed with regular hiding and showing (without destructing/removal). This means each link request the same url and load the same AJAX into each container #DIV. Very consumptive, since each link loads the same AJAX again and again.

  2. Create just a single #DIV and MOVE AROUND this #DIV into another .DIV (the same containing class, say .ajax-container).

So what I am trying to get is reusable and efficient code here. Any suggestions and examples would be very much appreciated.

UPDATE, added what has been done so far to clarify my question:

    $('a.browse')
             .click(function(){
                   var t = $(this);
                   t.show();
                   t.parent().prev().find('input.tex').addClass('focus');

                   // @TODO, avoid using remove(), and move this into another .hasPicker class instead to REUSE the same content
                   $('#imgPicker,#closebox').remove();

                   $('.picker-on').removeClass('picker-on');
                   t.parent().prev().find('input.tex').after('<div id="imgPicker"></div>').parent().addClass('picker-on');

                   // @TODO,  Check if #tabs has been loaded somewhere, and try to append it into current link that calls it
                   if ($('#tabs').length) {
                     t.parent().prev().find('#imgPicker').append('#tabs');
                   } else {
                     t.parent().prev().doAjax(); // load the same AJAX content
                   }
                   t.hide();

                   return false;
             });

$('input.tex').wrap('<div class="hasPicker"></div>');

And here is the doAjax() stuff:

    $.fn.doAjax = function() {
  return this.each(function() {
        // Check for pending request & cancel it
        if (req) req.abort ();

        //showLoading();
        req = $.ajax ({
                url: "?ajax=1",
                method:'GET',
                cache: true,
                success: function (data) {
                        $('#imgPicker').html(data).show().after('<span id="closebox"></span>');
                        $('#closebox').show();
                        $("#tabs").tabs();
                        // reset request
                        req = null;
                },
                 error:function() {
                   alert('Fail to load image collection.');
                }
        });
   });
};

Notes: #imgPicker is a dynamic container for #tabs. I used to have a ui.dialog, but seeing the size then I accomplished it with just a simple custom popup position absolute against the link and form requesting it. doAjax() is handled separately as a single request to load the same content (#tabs). input.tex is a set of textfield forms (where all items/options in #tabs can be stored.) followed by their link that request the same AJAX content via the same AJAX url.

Hope I can make myself clear.

Thanks

  • 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-13T14:52:51+00:00Added an answer on May 13, 2026 at 2:52 pm

    you can try the new released Jquery 1.4 I don’t know what are you trying to say but all i can see is you can use the .detach() function in jquery 1.4. This remove temporarily the data from the DOM and you can use it again as you want. Hope this helps.http://api.jquery.com/detach/

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

Sidebar

Related Questions

I have a modal popup with several links inside that have the :confirm and
I have a simple plot with several sets of points and lines connecting each
I'm plotting some functions that have several discontinuities. Each function is given as a
I have several sites that I want to link back to the main site
I have to use javascript to make links instead of for several unimportant reasons,
I have several pages to do with several table on each page. I've got
Through several threads I can see that the use of the MVC antiforgery token
I have several pages that are all very similar. They have some javascript rollover
We have several product lines built around a common core and currently maintain them
I have several large text files (30m+ lines, >1GB) which are being processed in

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.