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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T19:05:00+00:00 2026-05-26T19:05:00+00:00

HTML: <select id=single> <option>Single</option> <option>Single2</option> </select> <input value=load() id=test type=submit /> <div id=result></div> Script:

  • 0

HTML:

<select id="single">
    <option>Single</option>
    <option>Single2</option>
  </select>
<input value="load()" id="test" type="submit" />
<div id="result"></div>

Script:

$.ajaxSetup ({  
cache: false  
}); 
var loadUrl = "http://localhost/test/process.php";  
    $("#test").click(function(){  
          $("#result").load(loadUrl, "content=sd345f"+singleValues);  
    });
    function displayVals() {
      var singleValues = $("#single").val();
    }
    $("select").change(displayVals);
    displayVals();

That is my current code, I’m new to jquery and what i wanna ask is how do i make the var singleValues update when i choose a list from a dropdown and append it as a get value when i click on submit?

ANd here’s process.php BTW:

<?php file_put_contents('1.txt',$_GET['content']); ?>
  • 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-26T19:05:01+00:00Added an answer on May 26, 2026 at 7:05 pm

    If I understand right, you want to load the result when you click on the button.

    Try the following code:

    $("#test").click(function(){
        // get the selected value
        var value = $("#single option:selected").val();
    
        // GET to server
        $.ajax({
            type : "GET",
            url : "http://localhost/test/process.php",
            data : {
                "content" : value
            }, 
            success : function(response){
                $("#result").html(response);
            }
        });
        // Don't use default submit function
        return false;
    });
    

    More information about $.ajax http://api.jquery.com/jQuery.ajax/

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

Sidebar

Related Questions

I am using jquery my html code <input type=radio name=maritalstatus id=maritalstatus value=single/> single <input
I have the following HTML containing a drop down list (single selection) <script type="text/javascript">
Can I get html select option label based on option value <select id=xx> <option
I have html like this: <select name=sortProducts id=sortProduct multiple=multiple> <optgroup label=Availability> <option selected=selected value=option1>Low
I have a html element (like select box input field) in a table. Now
I have a single item HTML select box on which I'd like to find
Let's say I have an html form. Each input/select/textarea will have a corresponding <label>
In a Struts 1.x application, I have a form with a simple single-selection html:select
Here is the form: <p><label for=version_id>Version</label> <select id=version_id name=version_id><option></option> <option value=value1>2.1.1</option> <option value=value2>2.1.2</option> <option
I cannot get my addslashes function and html option value to play nice together.

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.