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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T08:28:47+00:00 2026-05-24T08:28:47+00:00

I am trying to create an ajax call, but it does not work, the

  • 0

I am trying to create an ajax call, but it does not work, the link is not even disabled.

My Jquery:

$('table th a').click(function(e) {
                var a = $(this).closest('a');
                $.ajax({
                        type: GET,
                        url: a.attr('href'),
                        data: a.serialize(),
                        success:function(msg){
                $('#formcontent').html(msg);
                                }
return false
                });

Part of my HTML:

<div id="formcontent">

Navn
Feature 1
Feature 2
Feature 3
Feature 4
Feature 5

</div>
  • 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-24T08:28:47+00:00Added an answer on May 24, 2026 at 8:28 am
    1. “GET” (your type parameter), needs to be a string:

      type: "GET",
      
    2. serialize() is for form elements, not anchor tags… what are you trying to achieve with it?

    3. And one I missed (as pointed out by ace in his answer), return false; in inside the AJAX call, not inside the click handler. (added for answer-completeness, not to steal anything away from ace!)

    As for problems which won’t stop the snippet working, but should be fixed:

    1. $(this).closest('a'); is completely redundant. Use $(this) instead.
    2. Instead of binding handlers to numerous elements (lots of work!) bind it to a single element instead, using either live() or delegate()

      $('table').delegate('th a', 'click', function(e) {
          var a = $(this);
          $.ajax({
              type: 'GET',
              url: a.attr('href'),
              data: 'something',
              success: function(msg) {
                  $('#formcontent').html(msg);
              }
              return false
          });
      });
      
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to create simple Ajax call, but after clicking the link I get
I'm trying to create a bookmarklet that will start off an AJAX call to
Im trying to create an ajax (post) event that will populate a table in
I am trying to create a simple log in system that uses ajax but
I am really suffering here trying to get this ajax call to work, sorry
I am trying to make an ajax call by passing named parameters: $this->Js->link('Save',array( 'controller'
I'm trying to create a jQuery plugin, inside I need to do an AJAX
I am trying to put a jQuery gallery after the Ajax call. On my
I'm trying to create a sort of chatbox system with PHP/MySql and AJAX but
I'm trying to get my AJAX call working with the rails 3, but I'm

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.