By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,480 Members | 1,229 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,480 IT Pros & Developers. It's quick & easy.

How to parse and reorder child elements for posting AJAX

P: 5
Heres my problem: my javacript code reads each child element e.g.:

<author>skateboard2</author><id>xqWBGvbvw7g</id><title>zach skating</title><length_seconds>100</length_seconds></video>

The order is author, id, title, length. I NEED to reorder to any I want title, author, length, id.

When it reads in via javascript and each <childelement> is formatted via CSS using relative styling its is shows up incorrectly. I need to reorder how each <childelement> is posted

set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP")
on error resume next "GET", url, false
xmlhttp.setRequestHeader "User-Agent","My funky browser."
xmlhttp.send ""
if err.number <> 0 then
response.write "Url not found"

read each parent, read each child, reorder the child elements, then post to below.

response.write xmlhttp.responseText
end if
set xmlhttp = nothing
Jun 14 '07 #1
Share this Question
Share on Google+
3 Replies

Expert Mod 15k+
P: 16,027
Welcome to TSDN!

Use document.getElementsByTagName('...') to get a specified tag.
Jun 15 '07 #2

P: 5
I know that.. how do you reorder all the children?
Jun 15 '07 #3

Expert Mod 15k+
P: 16,027
See this page and the next few on creating, adding, replacing and removing nodes.
Jun 18 '07 #4

Post your reply

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