This may sound too stupid but I have been going crazy for finding that out. I just need to know how to write XML in HTML
file so I can send it using Ajax
.
I know how to send XML
using XMLHttpRequest
after I have included external file but that is not what I am trying to do here. My XML file is really small like 3 tags. So I don't want to write external file for no reason. Please explain despite being good with Javascript,CSS, and HTML. I have very limited experince with XML. Mostly because I love JSON over all other methods...
function element(name,content){
var xml
if (!content){
xml='<' + name + '/>'
}
else {
xml='<'+ name + '>' + content + '</' + name + '>'
}
return xml
}
Call this function from a HTML page
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.