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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T02:09:56+00:00 2026-05-19T02:09:56+00:00

I have a table of data and I want the user to be able

  • 0

I have a table of data and I want the user to be able to click a column header and send a non-AJAX request that reloads the page with the data sorted by that column.

I could just make the column title a link, but I want them to be able to click anywhere in the column header so I’ve added hidden forms and I’m trying to use jQuery to submit the form when the clicks the column header.

The problem I’m hitting is that although it works exactly as expected for the second col header — a click submits the hidden form and reloads the page — but does not work at all for the first col header — the form does not get submitted.

  1. What is keeping the first column’s form from being submitted?

  2. Is there a better way to do this than using a hidden form?


HTML:

<th class='sortable'> 
  <form action='/procurements' class='sort_form' method='get'> 
    <input name='sort' type='hidden' value='title' /> 
  </form> 
  Title
  <img class='sort_indicator' src='/images/sort_unsorted.jpg' /> 
</th> 
<th class='sortable'> 
  <form action='/procurements' class='sort_form' method='get'> 
    <input name='sort' type='hidden' value='nature' /> 
  </form> 
  Procurement type
  <img class='sort_indicator' src='/images/sort_unsorted.jpg' /> 
</th>

JS:

$(document).ready(function(){
  $('table.tgr_datagrid th.sortable').click(
    function() {
      $(this).children( 'form' ).submit();
    }
  );
});
  • 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-19T02:09:56+00:00Added an answer on May 19, 2026 at 2:09 am

    If you are just doing a GET request then don’t bother using a form at all:

    $('table.tgr_datagrid th.sortable').click(function() {
        window.location = '/procurements?sort=' + $(this).text();
    });
    

    DEMO: http://jsfiddle.net/marcuswhybrow/NL3km/

    So in the context of your code you could have this, (note the custom data-sort-name attributes):

    <table>
        <tr>
            <th class='sortable' data-sort-name="title">
                Title
                <img class='sort_indicator' src='/images/sort_unsorted.jpg' /> 
            </th> 
            <th class='sortable' data-sort-name="nature"> 
                Procurement type
                <img class='sort_indicator' src='/images/sort_unsorted.jpg' /> 
            </th>
        </tr>
    </table>
    

    jQuery:

    $('th.sortable').click(function() {
        window.location = '/procurements?sort=' + $(this).attr('data-sort-name');
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a htlm table with lots of data the user might want to
I have about 1 million data in users table. Now I want each user
I have the data table from the jquery plugin dataTables (http://datatables.net/) that I want
I have a long list of data that I want to display in table
I have a MySQL table containing user submitted data. I want the administrator to
I have a table of names and ages that I want the user to
I have a simple database named customer with a single table data.I want to
I have a table with large amount of data and want to take too
I have a table of data with survey results, and I want to do
I have a table with many rows of data, and I want to show

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.