Click here to Skip to main content
15,895,256 members
Articles / Web Development / XHTML

(Re) Introducing AJAX for ASP.NET with Prototype

Rate me:
Please Sign up or sign in to vote.
4.90/5 (16 votes)
17 Dec 2008CPOL10 min read 60.7K   449   47  
Writing and using cross platform AJAX in ASP.NET applications.
<%@ Page Language="C#" AutoEventWireup="true" Inherits="WebApplication1.AJAX_test" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >

<script language="javascript" type="text/javascript">
  var xmlHttp = false;
  function getXmlHttpRequestObject()
  {
    try
    {
      //IE implementation
      xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
    }
    catch(e)
    {
      try
      {
      //Legacy implementation
      xmlHttp = new ActiveXObject("MsXml2.XMLHTTP");
      }
      catch(exp)
      {
       xmlHttp = false;
      }
    }
    if (!xmlHttp && typeof XmlHttpRequest != 'undefined')
    {
      //Mozilla based browsers
      //creating a native request object
      xmlHttp = new XmlHttpRequest();
    }
}
</script>

<head runat="server">
    <title>Untitled Page</title>
    <script type="text/javascript">
 
      function pageLoad() {
      }
    
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:ScriptManager ID="ScriptManager1" runat="server" />
        Your First AJAX application at work !
    </div>
    </form>
</body>
</html>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

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


Written By
Software Developer
United States United States
I'm a professional .NET software developer and proud military veteran. I've been in the software business for 20+ years now and if there's one lesson I have learned over the years, its that in this industry you have to be prepared to be humbled from time to time and never stop learning!

Comments and Discussions