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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T17:24:03+00:00 2026-05-27T17:24:03+00:00

How can I do an Ajax called based on a user updating a number

  • 0

How can I do an Ajax called based on a user updating a number in a text box?

I have something like the following. I removed surrounding code to make it easier to follow. I’m showing here two rows of a much larger grid.

           <div class="rep_tr0">
                <div class="rep_td0" id="2">0001</div>            
                <div class="rep_td0"><input id="position_1" name="position_1" size="5" type="text" value="0" /></div>                           
            </div>
            <div class="rep_tr0">
                <div class="rep_td0" id="2">0002</div>          
                <div class="rep_td0"><input id="position_2" name="position_2" size="5" type="text" value="0" /></div>
            </div>

What I need is when the user makes a change to one of the input fields named “position_x” then I need to

- get the value of the input field marked with "position_x"
- get the value that is stored in the div with id="x" 
- make an ajax call passing the two parameters.

Note that x marks the row number.

  • 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-27T17:24:04+00:00Added an answer on May 27, 2026 at 5:24 pm

    Something like this:

    
    $("input[id^='position_']").change(function() {
        //get the value of the input field marked with "position_x"
        var posX = $(this).val();
        var idArr = $(this).attr("id");
        var idTmp = idArr.split("_");
        var id = idTmp[1];
            var divX = $("div[id='"+id+"']").html();    
        make an ajax call passing the two parameters.
        $.ajax({
            type: "POST",
            url : "your_url",
            data: "pos_x="+posX+"&div_x="+divX,
            success: function(response) {
                alert(response);
            }
        });
    });
    
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

By using jquery ajax function, I can do something like: $.ajax({ url: url, type:
Can an Ajax-enabled WCF Service pass back a DataTable as a Sys.Data.DataTable? Like this
How is it that tools like this one can make an ajax style call
How can I validate that my ASPNET AJAX installation is correct. I have Visual
How can I achieve the following with the Ajax Control Toolkit MaskedEdit extender? Letter
I have a function that makes ajax GET request and based on the value
I'd like to have a div on my web page that is based off
Can you do ajax on ASP.net webform without using ajax toolkit? (Please post a
How can I assert my Ajax request and test the JSON output from Ruby
Can you tell me examples for jquery with ajax? Can I combine an UpdatePanel

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.