I am new to jQuery. I have to query 2 web services and based on an attribute value in first web service I have to query the next one and populate the result in a table using data from both web services.
Please have a look at the code at http://jsfiddle.net/ykPXZ/2/ . I am trying to append the table data to a div having id="tableData". I am getting the data from the web service and I have checked the console logs to see whether the data is getting appended to the variable tableDataA and it is getting appended but I am not to display the data on the web page. Somehow it is getting rewritten or deleted.
Please tell me if this is the best approach for solving this problem. Please suggest a better approach to it.
Thanks.
EDIT: Dynamically generated table is showing 23 rows instead of 24.
Hi, I am following the approach as mentioned by mu is too short in the first answer. The issue I am having now is that instead of getting all the 24 rows to be displayed in the table, it is displaying only 23 rows and missing the 1st row data. When I am logging it in the console, it shows all 24 entries but in the table 23 rows are getting displayed.
Please suggest some solution for the same.
Thanks.
EDIT: I have been able to solve the above issue of showing 23 rows instead of 24. It might be useful for others.In the correct answer below,instead of using the i, it should have been i+1.
$tr = $('#tableData table tr:eq(' + i + ')');
replace it by
$tr = $('#tableData table tr:eq(' + (i+1) + ')');
Thanks.