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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T00:47:09+00:00 2026-05-22T00:47:09+00:00

There are two links for sorting, SortName, SortDate. When using jquery load to load

  • 0

There are two links for sorting, SortName, SortDate. When using jquery load to load table ($(‘table.listing’).load…) then it works. When using $(‘form’).load… then it doesn’t work. Why is that?

Code below works, but if you change ‘table.listing’ to ‘form’ it doesn’t work. Problem is because links should load also, and they are in div above table, so I need to use ‘form’ or some div, although div wrapper also doesn’t work.

What means it don’t work: if you use ‘form’ you need to click links TWICE for container to load!?

<form method="post">
<div>
    <a href="" id="sortn">SortName</a><br/>
    <a href="" id="sortd">SortDate</a>
</div>
<table class="listing">
    ...table code here
</table>
</form>

<script type="text/javascript">
$(document).ready(function(){
    $('a#sortn').click(function(event) {
        event.preventDefault();
        $('table.listing').load('index.php?sort=1 table.listing');
    });
    $('a#sortd').click(function(event) {
        event.preventDefault();
        $('table.listing').load('index.php?sort=2 table.listing');
    });
});
</script>
  • 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-22T00:47:10+00:00Added an answer on May 22, 2026 at 12:47 am

    I’m not sure why loading on a form doesn’t work, but I wouldn’t do that. You should wrap your form in a div and then load everything into there. You’ll need to re-bind your click action after it loads too. What doesn’t work about wrapping it in a div?

    edit: Re-binding links after load completes:

    <script type="text/javascript">
    
        function doLoad(sort){
            //if you switch to the div method, obvously the selector needs to change
            var selector = "table.listing";
            //var selector = "#newDivId";
    
            $(selector).load('index.php?sort='+sort+' '+selector, function(){
                doBindings();
            });
        }
    
        function doBindings(){
            $('a#sortn').unbind('click');
            $('a#sortd').unbind('click');
            $('a#sortn').click(function(event) {
                event.preventDefault();
                doLoad(1);
            });
            $('a#sortd').click(function(event) {
                event.preventDefault();
                doLoad(2);
            });
        }
    
    
    $(document).ready(function(){
        doBindings();
    });
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

There is two links in my body part: but i want to give them
There is an unordered list, and one of the list items contains two links.
In my page there is two links, register and login. The important one now
i have a page where there are two links to pdf files. the first
Is there any way to map two links in a JAXB XML entity to
i have 5 divs , in each divs there's two links as shown in
doc.xpath(//div[@id='Ci_']).each_with_index do |div,i| parse_file.puts #{div.at_xpath(./*[@class='class1']).text} parse_file.puts #{div.at_xpath(./*[@class='class2']).text} There are two links in class2 and
The following two links helped me to locate the symbol table in visual studio.
Is there any easy way to calculate the number of lines changed between two
Ok, here's a problem script. var links = [ 'one', 'two', 'three' ]; for(

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.