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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T10:14:21+00:00 2026-05-20T10:14:21+00:00

I have HTML table with 10 rows and which has a Current Value column

  • 0

I have HTML table with 10 rows and which has a “Current Value” column and a “Price” column.

Q: The first row has 1000 dollars and 5 th row as 10000 dollars.

If a user has changed the price column to GBP, how can I make an ajax call through jQuery and update the current value.

What’s the best approach here?

  • 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-20T10:14:22+00:00Added an answer on May 20, 2026 at 10:14 am

    So the steps you are going to need to take (assuming PHP for now)….

    bind a handler to your currency selector. (assuming multiple currencies in a select for now). include a jQuery ajax call in this handler. Set a variable to equal the currency selected.

     window.onload=function(){
         $('#select_id').change(function(){
             var currency = $(this).val();
             $.ajax({
                type: "POST",
                dataType: "json",
                url: "/ajaxpage.php",
                data: {
                   currency:currency
                }
                success: function(data){
                   $.each($('#table tr ',function(index,value){
                       $(this).find('.price_col').html(data[index]);   
                   });
                },
                failure: function(){
                   alert('failed');
                }            
             });              
         });    
     }
    

    So here we have an ajax call to ajaxpage.php with the post data, currency. Let’s imagine that we are going to be returned an json encoded string with the new currency values. In the success handler, we iterate through the table rows, and update the appropriate table cell with its respective value. This is probably slightly backwards, so make sure the datasets match up.

    On the server side, all we have to do is return a json_encoded array that looks like

     array(
    
           [0] => '1234'
           [1] => '5555'
           // and so on
     )
    

    Once you have your new prices calculated (let me know if you need to send all the old prices also, I just assume you already know since they got there in the first place, but the situation may not be exactly as you describe), all you have to do to complete the magic ajax is….

     echo json_encode($array);
    

    I just saw that you are using Java…. you can use

     org.json.JSONObject
    

    and

    response.getWriter().print(jsonObject.toString());
    

    for this last part, and change the filename in the ajax request as appropriate.

    Edit: Based on your comment, I suggest giving each select a unique id and have all selects sharing a class. so that we don’t have to split the string in this example, let us say “1”, “2”, etc. And your rows having id row_1, row_2, etc.In this case, it will look something like…

    window.onload=function(){
         $('#.selector').change(function(){
             var row_id = $(this).attr('id');
             $.ajax({
                type: "POST",
                dataType: "json",
                url: "/ajaxpage.php",
                data: {
                   id:row_id
                }
                success: function(data){
                    $('#row_'+data.id).find('.price_col').html(data.cval);
                },
                failure: function(){
                   alert('failed');
                }            
             });              
         });    
     }
    

    Your JSON object to be returned in this case should be a single object with id and cval attributes. If you are having problems, to debug,

      console.log(data);
    

    in the first line of the success handler, and also check your dev tools in chrome/firefox under XHR requests. This will give you additional information about the request and the data you are returning.

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

Sidebar

Related Questions

I have an HTML table which has equally divided rows and columns. I would
I have a simple html table which has several rows. the following is implemented
I have an HTML table in which each data row has a unique id
I have an HTML table with various rows, each has a delete button with
I have a html file which has a huge table with 4 columns and
I have an HTML table which may contain thousands of rows (number of columns
I have a table containing a large number of rows. Each row has 2
I have a table containing a large number of rows. Each row has 2
I have a Html Table which consists of rows that were generated dynamically (from
I have a table in which i append rows on onclick event, the row

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.