473,404 Members | 2,187 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

looking for ajax code that will allow me to load two xml files in two tables on the s

Hi

I am looking for ajax code that will allow me to load two xml files in two tables on the same webpage. I look at w3 schools and I have used the code template at https://www.w3schools.com/js/js_ajax_xmlfile.asp get cd that loads XML files into a table AJAX XML Example
The following example will demonstrate how a web page can fetch information from an XML file with AJAX but cant figure out how to use it to do do 2 tables one webpage using document.getElementById("demo").innerHTML = table;
} not write
Dec 24 '18 #1
1 1791
gits
5,390 Expert Mod 4TB
well - a solution would fully depend on how you would fetch the data - either with 1 or with 2 requests.

if you would use 2 seperate requests then you could simply transfer the example you have to your problem - just make 2 requests and process the results in the callback function (in that example myFunction) - and make sure that your result elements have different ids that you would use for inserting the processed data.

if you want to do only 1 request - then the response would have to be parsed differently depending on how the response would look like (since in that case you would have to have both documents in the response somehow - may be combined into 1 'envelope'-document or combined into json-response as values for keys like doc1 and doc2 or however the response would be built in that case) - but again - parse it as needed and append the results to 2 different parts of the page by using different ids for the 'base-elements' of the content you wish to show.

you could use different attributes like class or even custom attributes of the elements instead of the ids - but ids are the 'easiest' to work with, since getElementById directly returns you a reference to a node with that id (given the node exists).
Dec 27 '18 #2

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

Similar topics

13
by: teenzbutler | last post by:
I have a 10mb ASP file, which will not load in IE 6.0. I get an HTTP 500 error. When I convert the 10mb file to HTML, it loads fine. Is there a limitation on file size? If so, is there a tag I...
2
by: r dubey | last post by:
Hi, I'm using webclient to enable download of files. However, files get copied to the server rather than the client machine. What could be the problem. Here is the sample that I've used: ...
1
by: alphanode | last post by:
When starting up my computer, I am able to open Internet Explorer windows and have them load without a problem, however once I open and run a .net project I am working on, this causes any new IE...
8
by: gumi | last post by:
Hi, I am looking for code for a alarm clock program that pops up a messege to be used as part of my VB.Net class project. Any help is very much appreciated. Thanks
8
by: jd2007 | last post by:
Why the Ajax code below in ajax.js is causing my form not to work ? ajax.js: var a=0; var b=0; var c=0; var d=0; var e=0; var f=0;
3
by: smartic | last post by:
I'm having Ajax code that work in Firefox and Opera but doesn't work in ie but it works only when i refresh the page can any one help me.
3
by: muziburrehaman | last post by:
i am looking for code in php to upload the 1 gb files. any one can please help me by sending the code....
2
by: ragazzo | last post by:
I am using this code to load files But i have problem when there is a large number of files, ( it shows nothing ) is it posible to list only files where date modified is today`s date. And show in...
2
bugboy
by: bugboy | last post by:
Hi, I would like to pass different element id's to the stateChange() function from the add_to_list() function but i'm afraid i don't quite get it. The reason is that i would like to reuse the same...
0
by: steve depp | last post by:
ooking for an application that will allow me to find specific DNN websites. example: need to find all sites that are DNN and are NON-Profit Organizations or all DNN sites that are Hospitals, etc. A...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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,...

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.