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

  • Home
  • SEARCH
  • 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 610839
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T17:43:07+00:00 2026-05-13T17:43:07+00:00

The client is making a request to the server. I need to take part

  • 0

The client is making a request to the server.
I need to take part of that request, and make the form button work with Ajax.

This piece of code works perfectly for links:

var pagination_render = function() {
    var pagination = $('.pagination a');
    pagination.each(function() {
        $(this).click(function(event) {
            load_server(this.href, '.houseindex');
            return false;
        });
    });
};
pagination_render();

I tried numerous things for making the Ajax button work, and this is one of the tries:

var contact_user = function () {
    $('.expanded').find('#submit').each(function() {
        $(this).unbind('click');
    });

    $('.expanded').each(function() {
        $(this).find('#submit').click(function(event) {
            form_submit($(this).parent(), '.contactuser .msg');
            return false;
        });
    });
}

Whenever there is a successful Ajax call, it goes through all of the expanded items, and then binds a click event.

Now, sometimes this code works, and sometimes it doesn’t.. When it doesn’t work, it disables other events (toggle links) I have set up.
It seems as if I need to wait a few ms for it to load the component into the DOM.. Do I?

  • 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-13T17:43:07+00:00Added an answer on May 13, 2026 at 5:43 pm

    So I get that when you call contact_user you:

    1. First unbind any previous binded click events from the submit button. I see one possible problem there and is that you are looking for an id of #submit. You should only have one id in a single page. Therefore you only need to use $('#submit').each(...) or if you have several submit buttons in the page either use a class if there are several submit buttons inside an .expanded item or just use $('.expanded :submit')
    2. Adding a custom event when clicking the submit button. Same thing, you can simplify this by $('.expanded :submit') or if you truly only have one button with an id of submit (quite confusing). Go with $('#submit').

    In conclusion:

    var contact_user = function(){
       $('.expanded :submit').unbind('click');
       $('.expanded :submit').click(function(){
          form_submit($(this).parent(), '.contactuser .msg');
          return false;
       });
    };
    

    the :submit selector will select all <input type="submit" />.

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

Sidebar

Ask A Question

Stats

  • Questions 317k
  • Answers 317k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer There is nothing to impove, you have to create route… May 13, 2026 at 11:48 pm
  • Editorial Team
    Editorial Team added an answer Perhaps you should wrap your flash file in a div… May 13, 2026 at 11:48 pm
  • Editorial Team
    Editorial Team added an answer Discovery on the fly sounds a lot like an extensibility/Add-In… May 13, 2026 at 11:48 pm

Related Questions

I have been reading up on the .Net RIA Services that Microsoft is developing
I'm interested in making a twitter client using Adobe Air, but I'm kinda stuck
I am trying to get RPC testing using GWT. I am using the default
I am making a web application. I have gotten a weird error with update
I've been looking at the standards - but was not entirely sure about the

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.