XML fetching using javascript

cookies

New Member
This code wont execute. I think there is something wrong with the \[code\]xhttp.send()\[/code\] function. Because the \[code\]alert\[/code\] function before it executes but the \[code\]alert\[/code\] function after it doesn't execute:\[code\]<html><head> <title>PAGE OUTPUT</title> <script type="text/javascript"> function aa() { var xhttp; alert("hi welcome"); if(window.XMLHttpRequest) { xhttp=new XMLHttpRequest(); alert("hi"); } else { xhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xhttp.open("GET","vehicle.xml",false); alert("OPEN EXECUTED"); xhttp.send(); alert("SEND EXECUTED"); xmlDoc=xhttp.responseXML; alert("HI I HAVE REACHED OVER HERE"); var vehicle=xmlDoc.documentElement; var car=vehicle.firstChild.nodeValue; var price=car.firstChild.nodeValue; alert(price); } </script> </head><body><center><input type="submit" onclick="aa()"></center></body>\[/code\]
 
Back
Top