Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

AJAX --> Working for HTML, but not for ASPX.

Status
Not open for further replies.

grande

Programmer
Joined
Feb 14, 2005
Messages
657
Location
CA
I have a basic AJAX page that loads another page. If I load an HTML page, it works fine, but if I try to load an ASPX page, it says "Error On Page" in the browser bar.

Any idea why this would be happening?

Code:
<html>
<head>
<script language="javascript">
    function loadurl(dest) { 
        try {
            xmlhttp = window.XMLHttpRequest?new XMLHttpRequest():new ActiveXObject("Microsoft.XMLHTTP"); 
        } catch (e) {  } 
        
        xmlhttp.onreadystatechange = triggered;  
        xmlhttp.open("GET", dest); 
        xmlhttp.send(null); 
    } 

    function triggered() { 
        if ((xmlhttp.readyState == 4) && (xmlhttp.status == 200)) {  
            document.getElementById("output").innerHTML = xmlhttp.responseText; 
        }
    }
</script>
<title>AJAX ftw</title>
</head>

<body>
<form id="Form1" runat=server>
    <div id="output2" onclick="loadurl('sc2.aspx')">Click here to view resume...</div>
    <div id="output"></div>
</form>
</body>
</html>

Thanks.

-------------------------
Call me barely Impressive Captain.
 
Yes, the ASPX page loads fine on its own.

-------------------------
Call me barely Impressive Captain.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top