473,671 Members | 2,279 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

add rows to table from an ajax response

1 New Member
In my first php file I have a table with multiple rows and form fields. When the user selects a category I call a second php file which returns new rows (<tr>) which have to be added to the table from the first php file:
Expand|Select|Wrap|Line Numbers
  1. <select name="in[catid]" style="width:200px;" id="categorie" onchange="getSubCat(this,0)"> <?=$optioncat?></select>
  2.  
the function getSubCat calls a php file using ajax and the result is set to innerhtml of div "result"
Expand|Select|Wrap|Line Numbers
  1. var e = document.getElementById('result'); 
  2.     e.innerHTML = ajax.response;
  3.  
How to correctly add those new rows to the table ?
Jul 25 '08 #1
1 2950
hsriat
1,654 Recognized Expert Top Contributor
Instead of using the innerHTML function, first add rows to the table by insertRow and then cells to the rows by insertCell. Then with that cell object, use innerHTML to insert data into that cell.
Jul 27 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
5310
by: addi | last post by:
All, I will be eternally greatful if someone can provide snippet of code, URL or reference material that shows how to display data in a "n colums * n rows" format. I am new to ASP and have looked everywhere that I could, but I have not found an example where data can be formatted to be displayed in a 3 * 4 foramt, like many of the professional sites would do (actually rows and columns can be any number of rows and columns) All the
0
2395
by: Luis Esteban Valencia | last post by:
Hello I wrote a program with code behind in C# to add row into table dynamically and the program worked very well in .Net Framework 1.1. When I run this program in .Net Framework 2.0 beta version, the program is not working as in version 1.1. So what is the problem? Microsoft declared that the version 2.0 is fully backward support, but it is not. Is that the problem with 2.0 version? I find out the problem in version 2.0. After...
2
6709
by: Garg | last post by:
How do I hide a paricular tablerow during run time? I have two table rows with ids row1 and row2. I want that if a particualr condition is true, then row 1 should be displayed on the web page, otherwise row2 should be dispalyed. I tried following code, but it is not working: row1.Style.Value = "block" row2.Style.Value="None"
4
1290
by: mortb | last post by:
Hi! I have a really large and complex table. The table may consist of several thousand rows. When I render the table with asp.net web controls the control won't stream out to the browser before the appending of rows is completed. The table is created in a custom web control. I know I can use Response.Write to directly output to the client, but I'd like to know if there is another way.
6
5142
by: =?Utf-8?B?U2hhd24gU2VzbmE=?= | last post by:
Greetings! I was researching AJAX to provide a solution to displaying status messages while a long process executed. I found several examples online and was able to use their code to get a quick application working. However, when attempting to implement the solution, the AJAX calls weren't updating the screen like the examples were and seemed not to fire until after the long running process had completed. I found the only real...
1
3402
by: shaunwo | last post by:
I'm an AJAX / DOM Novice (at best) and trying to figure out how to write the value to a couple input fields. I don't remember exactly where I got the ajax.js file I'm using from (went to the website that I see in the comments, but no luck there), but what I already have works GREAT to populate the options in a select box. Now I'm trying to take that same code and get it to write the value to a couple input boxes. Here's a link to my ajax...
9
2050
by: TechnoAtif | last post by:
<form name=frm action="" method="post"> <table> <tr><td><select name=combo> <option>1</option> <option>2</option> <option>3</option> <option>4</option> </select> <td><input type="text" name=tb1 value=""></td> <td><input type="text" name=tb2 value=""></td>
8
1820
by: freelance71 | last post by:
I have a combo box (select) and when the user selects a value I want to populate an HTML table from DB depending on the value selected. Whats the easiest way to achieve it. I've searched google and the examples require java script. Is there a way to do this with only PHP. I had the impression you could do anything with PHP. Infact there is a book titled 'How to do every thing in PHP'! -- When you argue with a fool, chances are he's doing...
2
3616
by: chris f | last post by:
I have an ASP.NET 2 web page that dynamically populates an ASP table in the Page_Load event. Rows relate to different people and I want to let the user display only rows for a particular person when they select them from a dropdown list on the same page. (Each row has a hidden PersonId column.) The page initially shows the rows for all people. Is it possible to hide the rows for the other people when the user selects a person from the...
0
8481
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8924
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8823
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8672
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7441
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6234
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4227
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2817
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1814
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.