jquery xml parsing foreach

rj-karter

New Member
I need to get data from xml file\[code\] <?xml version="1.0"?> <xml> <User> <Agent> <id>cr4523</id> </Agent> <Time> <Time_Main>2-3pm</Time_Main> <Day>Mon</Day> <Time_Main>3-4pm</Time_Main> <Day>Mon</Day> <Time_Main>10-11am</Time_Main> <Day>Tue</Day> </Time> </User> </xml>\[/code\]My problem is that a: not sure if my xml file is correctly formatted and b: the jquery I am using compressess all the data together, albiet in 'Time_Main' sections and 'Day' sections.What I require is for each Time_Main and Day I need to call a simple function.The jquery I am using is -\[code\] $(html).find('Time').each(function(){ var day=$(this).find('Day').text(); var time_main=$(this).find('Time_Main').text(); });\[/code\]
 
Back
Top