javascript array

From above example, I would like to return to array in javascript. How can I do that?
The ideal result will be like


Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ray PaseurCommented:
That's a very, very old example and you should not be using it.  We use jQuery for this sort of thing now-a-days and we use JSON instead of XML.

How does this fit into the PHP Zone?
ITsolutionWizardAuthor Commented:
Regardless, I want to use my existing codes base. Please continue if you know how.
greetings ITsolutionWizard, , In the code for the w3shools web page you gave they have this -

as what I consider to be the "Return" from an XML ajax request made with this -"GET","cd_catalog.xml",false);

so I can not understand what you mean, OR what you might need when you say - "return to array in javascript."
you say the result would be like -

but as you may know, , any AJAX return is just a "text" output from the server, if you use the -
then the javascript will use the text as a XML DOM object with properties, So if you use the XML as the w3schools does, then you will have to use the XML tags to assign values, but you do not get an array.

If you abandon the XML ajax formatting, then you can get a CSV delimited text, and use -
to get an array.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ITsolutionWizardAuthor Commented:
Then just send me example from xml string to array written in JavaScript
you say you want an array fron XML? ?, below is untested code , that I just wrote, for here, this -
for (i=0;i<x.length;i++)
  array1.push( x[j].getElementsByTagName("ARTIST")[0].childNodes[0].nodeValue );

should place the artist values from the XML into array1
var xmlhttp = false;
@if (@_jscript_version>=5)try{xmlhttp = new ActiveXObject('Msxml2.XMLHTTP.4.0');} catch(e){
	try{xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");} catch(e){
	try{xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");} catch(E){xmlhttp=false;}}}
	@else xmlhttp = false;
@end @*/
if(!xmlhttp && typeof XMLHttpRequest !='undefined'){try{xmlhttp = new XMLHttpRequest();} 
catch(e){xmlhttp = false;}}

array1 = [];"GET","cd_catalog.xml",false);

var x=xmlDoc.getElementsByTagName("CD");
for (i=0;i<x.length;i++)
  array1.push( x[i].getElementsByTagName("ARTIST")[0].childNodes[0].nodeValue );


Open in new window

hopefully you can see some of what this does, ask questions if you need more info.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.