473,382 Members | 1,657 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,382 software developers and data experts.

Ajax loading data from multiple xml files

So, I'm in a pickle...

Lets say I have a page: http://www.gen2host.com/discgolf/index.html

and on this page, there are a list of links. These links will be
generated by 5 pieces of data pulled from each .xml file in a
subdirectory on the webserver.

Ex <A Href=" [DATA1] "[DATA2] </a[DATA3,4,5] as text.

Now, that being said, I have finished writing the javascript that
solves this problem by using a XMLHttpRequest on each file to be in
parsed. And If, at the end of each file being parsed, I spit my output
to the InnerHTML of a div, the page turns out looking ok...

( now heres the problem )

....except for the fact that all of the links seem to be in random
order. More specifically, they order themselves based on the time that
each xml file finished parsing.
In an attempt to sort all of the links before spitting them out on to
the div, I'm thinking of loading all of the data into a dynamic array
with each value consisting of an array of 5 values.

In the code posted above, I have successfully created the dynamic
array. My last attempt to get closer to fixing my sorted array problem
was to try using an onload statement, but it appears that when the page
is loaded, the XMLHttpRequests are still parsing, so It tells me the
array is null.

Any thoughts on how one might start a function once all of the
XMLHttpRequests have completed?

(sorry if none of that made any logical sense to anyone but me...)

Jul 10 '06 #1
8 3273

"jhoff" <jh***@elitepcrepair.comwrote in message
news:11**********************@p79g2000cwp.googlegr oups.com...
So, I'm in a pickle...

Lets say I have a page: http://www.gen2host.com/discgolf/index.html

and on this page, there are a list of links. These links will be
generated by 5 pieces of data pulled from each .xml file in a
subdirectory on the webserver.

Ex <A Href=" [DATA1] "[DATA2] </a[DATA3,4,5] as text.

Now, that being said, I have finished writing the javascript that
solves this problem by using a XMLHttpRequest on each file to be in
parsed. And If, at the end of each file being parsed, I spit my output
to the InnerHTML of a div, the page turns out looking ok...

( now heres the problem )

...except for the fact that all of the links seem to be in random
order. More specifically, they order themselves based on the time that
each xml file finished parsing.
In an attempt to sort all of the links before spitting them out on to
the div, I'm thinking of loading all of the data into a dynamic array
with each value consisting of an array of 5 values.

In the code posted above, I have successfully created the dynamic
array. My last attempt to get closer to fixing my sorted array problem
was to try using an onload statement, but it appears that when the page
is loaded, the XMLHttpRequests are still parsing, so It tells me the
array is null.

Any thoughts on how one might start a function once all of the
XMLHttpRequests have completed?

(sorry if none of that made any logical sense to anyone but me...)
it makes sence ;)

move all the bits that'll run on page load into a function init()
if (window.addEventListener) {
window.addEventListener('load', init, false);
} else if (window.attachEvent) {
window.attachEvent('onload', init);
} else {
alert('Get yourselve a normal browser!');
}
put a counter inside this block:

var i = 0;if (http_request.readyState == 4) {
if (http_request.status == 200) { i++;if counter = amount of xml
files to proces... run the function that sorts the array and then write it
to the div...
Jul 10 '06 #2
yay... let me try that again...

move all the bits that'll run on page load into a function init()

if (window.addEventListener) {
window.addEventListener('load', init, false);
} else if (window.attachEvent) {
window.attachEvent('onload', init);
} else {
alert('Get yourselve a normal browser!');
}
put a counter inside this block:

var i = 0;
if (http_request.readyState == 4) {
if (http_request.status == 200) {
i++;

if counter = amount of xml files to proces... run the function that sorts
the array and then write it
to the div...
Jul 10 '06 #3
Thanks, that helped out a lot. It appears to be creating the array
completely before it kicks off the final populatedata() function...

Now to sort.... and test with lots more files.

Thanks again!

Jul 10 '06 #4
I'm fascinated. Why are you loading these xml files to get golf course
data? I'm not knocking it; I'm interested in knowing the situation that
requires your solution.

jhoff wrote:
Thanks, that helped out a lot. It appears to be creating the array
completely before it kicks off the final populatedata() function...

Now to sort.... and test with lots more files.

Thanks again!
Jul 10 '06 #5
bobzimuta said the following on 7/10/2006 7:27 PM:
I'm fascinated.
I am fascinated by people who can't follow the general convention of a
Usenet group and read the FAQ of that group with regards to posting
style that is preferred in this group.
Why are you loading these xml files to get golf course data?
Maybe because the data s/he needs is in those xml files?
I'm not knocking it; I'm interested in knowing the situation that
requires your solution.
See above.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Temporarily at: http://members.aol.com/_ht_a/hikksnotathome/cljfaq/
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Jul 11 '06 #6
Maybe some of us use Google Groups to do our usenet browsing. If you
don't like it, submit a bug report to Google. Otherwise, get used to it
and stop whining.

I didn't ask you why that person was using the XML format, so mind your
own business and stop trolling.

Randy Webb wrote:
bobzimuta said the following on 7/10/2006 7:27 PM:
I'm fascinated.

I am fascinated by people who can't follow the general convention of a
Usenet group and read the FAQ of that group with regards to posting
style that is preferred in this group.
Why are you loading these xml files to get golf course data?

Maybe because the data s/he needs is in those xml files?
I'm not knocking it; I'm interested in knowing the situation that
requires your solution.

See above.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Temporarily at: http://members.aol.com/_ht_a/hikksnotathome/cljfaq/
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Jul 11 '06 #7
bobzimuta said the following on 7/11/2006 4:47 PM:
Maybe some of us use Google Groups to do our usenet browsing.
Nothing wrong with that.
If you don't like it, submit a bug report to Google.
Submit a bug report to Google? What would it say?

Bug Report:

Your users are too ignorant to read and follow conventions. Please fix
this problem ASAP.

Yeah, nice bug report.
Otherwise, get used to it and stop whining.
I didn't ask you why that person was using the XML format, so mind your
own business and stop trolling.
This is Usenet. You post, it gets replied to and discussed. Get used to
it, it's the way it works.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Temporarily at: http://members.aol.com/_ht_a/hikksnotathome/cljfaq/
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Jul 12 '06 #8
JRS: In article <11**********************@s13g2000cwa.googlegroups .com>
, dated Tue, 11 Jul 2006 13:47:48 remote, seen in
news:comp.lang.javascript, bobzimuta <ej******@gmail.composted :
>Maybe some of us use Google Groups to do our usenet browsing. If you
don't like it, submit a bug report to Google. Otherwise, get used to it
and stop whining.
There's no difficulty in doing it right when using Google Groups.

This is a Usenet newsgroup, to which Google have provided their own
peculiar form of Web interface. Experienced users of Usenet follow
long-established conventions.

If you find that, when you start a News reply, Google does not provide
the previous article in quoted form, note what Keith Thompson wrote in
comp.lang.c, message ID <ln************@nuthaus.mib.org:-
If you want to post a followup via groups.google.com, don't use
the "Reply" link at the bottom of the article. Click on "show
options" at the top of the article, then click on the "Reply" at
the bottom of the article headers.

Since that is what the experts in this newsgroup prefer to read, it will
be to your advantage to comply.

--
© John Stockton, Surrey, UK. yyww merlyn demon co uk Turnpike v4.00 MIME ©
Web <URL:http://www.uwasa.fi/~ts/http/tsfaq.html-Timo Salmi: Usenet Q&A.
Web <URL:http://www.merlyn.demon.co.uk/news-use.htm: about usage of News.
No Encoding. Quotes before replies. Snip well. Write clearly. Don't Mail News.
Jul 12 '06 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: caston | last post by:
Well, everybody can now agree with the fact that the Ajax hype is over. Still multiple Ajax Frameworks are flourishing, aren't they? So, last night I questioned myself with the following: "When...
1
by: geevaa | last post by:
http://www.phpbuilder.com/columns/kassemi20050606.php3 XMLHttpRequest and AJAX for PHP programmers James Kassemi Introduction: Although the concept isn't entirely new, XMLHttpRequest...
17
by: Arjen | last post by:
Hi, I want to reload 2 divs at one click. Ive tried: <a href = "javascript:void(0);"...
11
by: =?Utf-8?B?R2VyaGFyZA==?= | last post by:
I have run into a situation that if a page/tab that uses the Ajax toolkit (using .net version 3.5) is closed before the Ajax enable controls complete loading, then IE locks up. Does it in both IE7...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.