By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,301 Members | 1,752 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,301 IT Pros & Developers. It's quick & easy.

Ajax inside Ajax :- not refernacing

P: 1
Hi ,

We have an HTML page which is using AJAX. We make an AJAX call which retrieves a table with mutiple rows. We need to extend this functionality. In the table, we want to put a button on each row. When this button is pressed, we want to update just the single row and keep the rest of the table the same.

Currently the AJAX call looks something like this:

document.getElementById("My_Div").innerHTML=xmlHtt p.responseText;

The server page returns the table as HTML dynamically and the returned HTML containing the table is fetched into the DIV.
--------------------------------------------------------

The problem is that the returned HTML Table is not visible in the original page source (as it is returned dynamically at run time). We need to reference a particular row in the returned Table and make another AJAX call inside the original AJAX call that fetches the RowID gets the new values and then updates just the one row.

--------------------------------------------------------

Call flow:

a) AJAX call
b) Server generates an HTML table
c) Client writes returned HTML into DIV

Required Call Flow:

a) AJAX call
b) Server generates an HTML table
c) Client writes returned HTML into DIV
d) Each HTML Table Row Has a Button (next) - Row_ID = N
e) On button Press Update Row_N with a new value fetched by different AJAX call.


-----------------------

We tried to implement the button call with the original code. The problem is that we are not able to reference the table because it is dynamically generated. How do you reference that table object to manipulate the rows.

Has anyone excountered this problem?
Apr 8 '08 #1
Share this Question
Share on Google+
2 Replies


100+
P: 130
just add to the raw (from the server that generate the code) an update button on click will call a function that recive the new value and the element id of that raw
and will update it in the database (assuming u generate the table from a database) and this is tha part i am not sure will work, replace only the raw
innerHTML='<tr id=""> <tr>'
Apr 8 '08 #2

acoder
Expert Mod 15k+
P: 16,027
We tried to implement the button call with the original code. The problem is that we are not able to reference the table because it is dynamically generated. How do you reference that table object to manipulate the rows.

Has anyone excountered this problem?
Just because you can't see it in the original page source doesn't mean it's not there. Use a tool like Firebug to see the current source. Either change the server-side script to generate the table with buttons or you can use DOM methods such as document.getElementById() to access the table to add the buttons.
Apr 9 '08 #3

Post your reply

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