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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T15:38:00+00:00 2026-05-22T15:38:00+00:00

I have a problem with this jQuery code. It doesn’t work as expected: $(‘#select_dropdown’).change

  • 0

I have a problem with this jQuery code. It doesn’t work as expected:

$('#select_dropdown').change ( function(){
    $('#form_to_submit').submit( function(event){
        $.post("process.php", { name: "John" },
    function(data) {
        alert("Data Loaded: " + data);
    });
    });
});

However, this works:

$('#select_dropdown').change ( function(){
    $('#form_to_submit').submit();
});

I wonder why the internal function on submit doesn’t work.
When a user selects a value from a dropdown, the form must be submitted. The second set of codes
work but if I add an inner function to submit, it doesn’t.

Basically, I want to do some ajax call after the user select on the dropdown.

  • 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-22T15:38:01+00:00Added an answer on May 22, 2026 at 3:38 pm

    The first code is creating an event handler for submit event on selector $(‘#list_count’) most likely a form element. The second code is calling the submit method on that element. The first one would be triggered when you submit the form using any method but it itself would not submit the form. What are you trying to do?

    EDIT

    Do you want to do this

    $('#select_dropdown').change ( function(){
        $.post("process.php", { name: "John" }, function(data) {
            alert("Data Loaded: " + data);
        });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have problem compilin this code..can anyone tell whats wrong with the syntax CREATE
I can use this jQuery code to dynamically change the RSS link in the
I have this jQuery code that handles hovering over rating stars, when you hover
I have this problem I'm hoping someone knows the answer to. I have an
I seem to have a problem with this SQL query: SELECT * FROM appts
everybody; I have this problem in asp.net, I have a page where I insert
Consider this problem: I have a program which should fetch (let's say) 100 records
I have seen this problem arise in many different circumstances and would like to
I have faced this problem quite often during the last couple of months, during
I have a similar problem to this post . I need to display up

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.