Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

Problem With XMLHttpRequest

$
0
0

Example pic

I want to print a sentence with a capital letter and underline - Like it shows in the pic above.

I get that sentence through the Web Service had been using the object XMLHttpRequest.

It Works With Internet Explore,  Not Working In: Google Chrome , Firefox, Opera

cod in javascript:<script language="javascript" type="text/javascript">
        ShowDataFromWebService();
        function ShowDataFromWebService() {

            var xhr = new XMLHttpRequest();
            var url = "WebService.asmx/HelloWorld";

            xhr.open("GET", url, true);
            xhr.onreadystatechange = function(response) {

           if (xhr.readyState == 4 && xhr.status == 200) {

               if (document.getElementById("tdInfo").innerHTML != null) {

                   // Google Chrom   FireFox  Opera
                   if (typeof xhr.responseXML.text == "undefined")
                   {
              document.getElementById("tdInfo").innerHTML = (new XMLSerializer()).serializeToString(xhr.responseXML);
                   }
                   else   // Internet Explorer
                   {
                       document.getElementById("tdInfo").innerHTML = xhr.responseXML.text;

                   }

               }

            }

       }

            xhr.send();

    }
    
    </script>


cod in Html:
<table border="1"><tr><td id="tdInfo"> </td></tr></table>


cod in WebService.cs:

 [WebMethod]
    public string HelloWorld() {
       
        return  "<h1><u>Hello World</u></h1>";
    }

 Link To My Project:     http://www.loveburn.com/visitors/miclala/fil1.zip

Thanks

Meir


 


Viewing all articles
Browse latest Browse all 5678

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>