how to get node value from var containing xml file data using java script
-
Hi how can I get node value from var containing xml file data using javascript. thanks.
You get the best out of others when you give the best of yourself.
-
Hi how can I get node value from var containing xml file data using javascript. thanks.
You get the best out of others when you give the best of yourself.
Are you looking for something like this? http://www.w3schools.com/Xml/xml_parser.asp[^]
-
Are you looking for something like this? http://www.w3schools.com/Xml/xml_parser.asp[^]
Hello in below code after getting xml data in variable now I want to get node value of first child. I have tried but not able to access node value but when I'm showing that var in alert message it's showing data in xml format. thanks see below code: <script language="javascript" type="text/javascript"> <!-- //Browser Support Code function ajaxFunction(){ var ajaxRequest; // The variable that makes Ajax possible! try{ // Opera 8.0+, Firefox, Safari ajaxRequest = new XMLHttpRequest(); } catch (e){ // Internet Explorer Browsers try{ ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try{ ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e){ // Something went wrong alert("Your browser broke!"); return false; } } } // Create a function that will receive data sent from the server ajaxRequest.onreadystatechange = function(){ if(ajaxRequest.readyState == 4){ document.myForm.time.value = ajaxRequest.responseText; //alert(ajaxRequest.responseText) ajaxResponse = ajaxRequest.responseText; //ajaxResponse contains xml data now I want get node value of first child } function verify() { // 0 Object is not initialized // 1 Loading object is loading data // 2 Loaded object has loaded data // 3 Data from object can be worked with // 4 Object completely initialized if (xmlDoc.readyState != 4) { return false; } } //--> </script>
You get the best out of others when you give the best of yourself.
-
Hello in below code after getting xml data in variable now I want to get node value of first child. I have tried but not able to access node value but when I'm showing that var in alert message it's showing data in xml format. thanks see below code: <script language="javascript" type="text/javascript"> <!-- //Browser Support Code function ajaxFunction(){ var ajaxRequest; // The variable that makes Ajax possible! try{ // Opera 8.0+, Firefox, Safari ajaxRequest = new XMLHttpRequest(); } catch (e){ // Internet Explorer Browsers try{ ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try{ ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e){ // Something went wrong alert("Your browser broke!"); return false; } } } // Create a function that will receive data sent from the server ajaxRequest.onreadystatechange = function(){ if(ajaxRequest.readyState == 4){ document.myForm.time.value = ajaxRequest.responseText; //alert(ajaxRequest.responseText) ajaxResponse = ajaxRequest.responseText; //ajaxResponse contains xml data now I want get node value of first child } function verify() { // 0 Object is not initialized // 1 Loading object is loading data // 2 Loaded object has loaded data // 3 Data from object can be worked with // 4 Object completely initialized if (xmlDoc.readyState != 4) { return false; } } //--> </script>
You get the best out of others when you give the best of yourself.
Try with ajaxResponse.firstChild to get the first child of ajaxResponse node.
-- http://ashakthi.blogspot.com http://kids-articles.blogspot.com
-
Try with ajaxResponse.firstChild to get the first child of ajaxResponse node.
-- http://ashakthi.blogspot.com http://kids-articles.blogspot.com
not working it's showing null value in alert message. thanks
You get the best out of others when you give the best of yourself.