Click here to Skip to main content
16,009,477 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello

In My Client Side Code,In objXMLHttpRequest.responseText
I Recieve Full Response ,Where as I JUst Want The Section That I Write With
Response.Write() at Server Side Code.

I Have This Problem At IE7.
At GoogleChrome Browser It is Correct.

How Can I Fix It in IE7 Like GoogleChrome?
JavaScript
<script type="text/javascript" language="javascript">
     function GetData() {

         var objXMLHttpRequest;

         objXMLHttpRequest = new XMLHttpRequest();
         objXMLHttpRequest.open("GET","Data.aspx",true);
         objXMLHttpRequest.send();

         objXMLHttpRequest.onreadystatechange = function () {
             if (objXMLHttpRequest.readyState == 4
                 &&
                 objXMLHttpRequest.status == 200)
                 {
                 document.getElementById("dvData").innerHTML =
                 objXMLHttpRequest.responseText;
             }
         }
     }
 </script>
Posted
Updated 6-Sep-12 21:47pm
v3

1 solution

You should use "Microsoft.XMLHTTP" in IE7 and "XMLHttpRequest" in other browsers:
Replace "objXMLHttpRequest = new XMLHttpRequest();" with these lines:
JavaScript
if (window.ActiveXObject)
    objXMLHttpRequest = ActiveXObject("Microsoft.XMLHTTP");
else if (window.XMLHttpRequest) 
    objXMLHttpRequest = new XMLHttpRequest();
else
{
    alert("Your browser doesn't supoort AJAX");
    return null;
}
 
Share this answer
 
v2

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