<script type="text/javascript">
if (window.XMLHttpRequest)
{ my_xml=new XMLHttpRequest();
}
else
{
my_xml=new ActiveXObject("Microsoft.XMLHTTP");
}
</script>
XMLHttpRequest is widely used in Ajax to interact with server without reloading the page. Along with any server side scripting language we can develop powerful applications. You can read more on our PHP Ajax section.
https://www.plus2net.com/php_tutorial/file-xml-demo.xml
Here is the code to read the xml file.
<script type="text/javascript">
if (window.XMLHttpRequest)
{ my_xml=new XMLHttpRequest();
}
else
{
my_xml=new ActiveXObject("Microsoft.XMLHTTP");
}
/////////////////////////////
my_xml.open("GET",'https://www.plus2net.com/php_tutorial/file-xml-demo.xml',false);
my_xml.send();
xml_str=my_xml.responseXML;
</script>
Displaying node value of xml file
Author & Instructor at plus2net
I write and maintain practical tutorials on Python, PHP, SQL, JavaScript, HTML, jQuery, and web development at plus2net. The tutorials focus on clear explanations, working examples, and code that readers can test and adapt while learning.