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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T21:40:25+00:00 2026-05-17T21:40:25+00:00

Hello i want in the moment i select a value to post to the

  • 0

Hello i want in the moment i select a value to post to the process.php page .
I have this code:

<select name="sweets" id="sweets" >
<option value="1">Chocolate</option>


<option value="2">Taffy</option>

<option value="3">Fudge</option>
<option value="4">Cookie</option>

and jquery:

 $("#sweets").change(function () {
      var str = "";
      $("select option:selected").each(function () {
            str += $(this).val() + " ";
         var q =  $(this).val();
          var dataString = 'q=' + q; 

           });
      $("div").text(str);
        $.ajax({
                    type: "POST",
                    url: "process.php",
                    data: dataString,
                    success: function() {
                                         $('#form').slideUp('slow');
                                        }
                })

    })

    .change();

and i can’t make it post the value to process.php.

Any help is appreciated,

thank you

  • 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-17T21:40:25+00:00Added an answer on May 17, 2026 at 9:40 pm

    You’re declaring dataString in an odd spot, but you can get the .val() of the <select> directly much easier, like this:

    $("#sweets").change(function () {
      $("div").text($(this).val());
      $.post("process.php", { q: $(this).val() }, function() {
        $('#form').slideUp('slow');
      });
    }).change();
    

    In the above I also converted your code to use $.post() just as a shortcut, but it has the same effect.

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

Sidebar

Related Questions

I have a onclick function like this onclick = function(){alert('hello')} I want to add
ok so i have have this {status:0,id:7aceb216d02ecdca7ceffadcadea8950-1,hypotheses:[{utterance:hello how are you,confidence:0.96311796}]} and at the moment
hello atm I have this code private void checkBox1_CheckedChanged(object sender, EventArgs e) { if
hello i want i have function to get paragraph of selected text. this is
hello i want to add param value to all the object in a page.
I have: %{ lorem ipsum dolor sit %{hello world}% amet}% I want: hello world
Hello I have the next problem, I want to render the html of my
Hello all I have this problem that I can't seem to fix. I've been
Hello all i have a wheel picker working but at the moment it is
Hello , I have a issue at the moment and I am not able

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.