Click here to Skip to main content
15,886,518 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have written following code
XML
<script type="text/javascript" language="javascript">
       function GetHttpRequestObject() {

               xmlhttp = new XMLHttpRequest();

               if (xmlhttp != null) {

                   xmlhttp.open("Get", "../Book.xml", true)
                   alert(xmlhttp.responseText);

               }
               else {

                   alert("not created");

               }

       }

   </script>

i have Book.xml file at root .
when i am running this code i am getting blank alert message, but i think it should show values written in xml. please help me out here
Posted
Updated 2-Aug-11 18:51pm
v2

1 solution

C#
if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
           xmlhttp = new XMLHttpRequest();
       }
       else {// code for IE6, IE5
           xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
       }
       xmlhttp.onreadystatechange = function () {
           if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
               message1.innerHTML = xmlhttp.responseText;
           }
       }
       xmlhttp.open("GET", "../Book.xml", true);
       xmlhttp.send();




Try it...
 
Share this answer
 
Comments
spydeehunk 3-Aug-11 1:06am    
not working still m getting the alert message Empty
Pravinjas 3-Aug-11 1:16am    
in my code instead of message1.innerhtml take alert message.
dont take alert message bellow ur file call.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900