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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T19:25:13+00:00 2026-06-07T19:25:13+00:00

I need to place ajax request result to existing table, how can it be

  • 0

I need to place ajax request result to existing table, how can it be done? here is my ajax request

$("input#order").click(function(){
    var idmenu  = $("#idmenu").val();
    var menu    = $("#idmenu :selected").text();
    var qty     = $("#qty").val();

    $.ajax({
        type    :'POST',
        url     :'<?php echo base_url();?>index.php/welcome/process',
        data    :'idmenu='+idmenu+'&menu='+menu+'&qty='+qty,
        beforeSend:function(){
            $("#result").html('<img src="<?php echo base_url();?>assets/loading.gif"/>');
        },
        success:function(result){
            //result is json format
        }
    });

});

here is the json format from ajax request

{"itemname":"product1","qty":"3","prices":"4500"}

and here is my table format

<table class="list-order">
    <tr>
        <th class="order">order</th>
        <th class="qty">qty</th>
        <th class="pice">price</th>
    </tr>
    //how to append ajax result here
    <tr>
        <td colspan="2"></td>
        <td align="right"><input type="submit"  size="25" id="process" value="Proses"/></td>
    </tr>
</table>

i want to append the result from ajax like

<tr>
    <td></td>
    <td></td>
    <td></td>
</tr>

and Not inside the tag, like

<tr>
   <td>result is not here</td>
</tr>

final result look like this one

<table class="list-order">
    <tr>
        <th class="order">order</th>
        <th class="qty">qty</th>
        <th class="pice">price</th>
    </tr>
    <!-- result look like this -->
    <tr>
        <td>product1</td>
        <td>2</td>
        </td>4500</td>
    </tr>
    <!-- end result-->
    <tr>
        <td colspan="2"></td>
        <td align="right"><input type="submit"  size="25" id="process" value="Proses"/></td>
    </tr>
</table>
  • 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-06-07T19:25:15+00:00Added an answer on June 7, 2026 at 7:25 pm

    Without knowing the exact format of your JSON, it’s hard to give a definitive answer. However, assuming you have a JSON array of objects that represent your rows, you’d need to iterate over that array and for each object do the following:

    • Create a new <tr> element – var $tr = $('<tr/>');
    • For each item of information (I assume one item per <td>), create a <td> element and set its content – var $td = $('<td/>').html(x.y) (x is your current object, y is a field in the object) then append it to the row – $tr.append($td);.
    • Append the row before the last row in the existing table – $('.list-order tr:last').before($tr);

    Following from the additional information provided in the question, the following code should do what you need to do:

    success: function(result) {
        //result is json format
        var $tr = $('<tr/>');
        $tr.append($('<td/>').html(result.itemname));
        $tr.append($('<td/>').html(result.qty));
        $tr.append($('<td/>').html(result.prices));
        $('.list-order tr:last').before($tr);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to place the result of an ajax get into a javascript variable.
here is the working fiddle: http://jsfiddle.net/2bNsC/67/ I need to place the 3 items (text
I need to make an AJAX request from a website to a REST web
I need to place default text to all rows for particular column in jquery
We need to place text over objects in a web page, similar to this:
I need to place several DatePicker widgets into the row. If there is not
I have this need to place my app in the share/send context menu so
I am working on an application where i need to place a uiscrollview within
I have outer div and inner div. I need to place inner div at
I'm developing a graph control in WPF. I need to place a Canvas on

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.