1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

AJAX Implementation in ASP 3.0

Discussion in 'ASP' started by naimish, Jul 3, 2009.

  1. naimish

    naimish New Member


    To implement AJAX in ASP 3.0.


    This is a simple application illustrating how AJAX can be implemented in ASP 3.0.

    The code

      <title>Sample AJAX in ASP  </title>
      <script language="javascript">
       var XMLHTTPReq;
       // This is the function that makes an AJAX request to the Server side scripting written in ASP 3.0
       // This function can be enhanced to incorporate any changes to suit any business logic and can
       // be successfully implemented.
       function CheckName()
        var strEmpName = document.all.EmpName.value;
        /* The link to the server side scripting */
        var strURL = "SampleSrv.asp?EmpName=" + strEmpName;
        /* Important: This line initiates the httprequest variable */
        if (window.ActiveXObject) { 
         XMLHTTPReq = new ActiveXObject("Microsoft.XMLHTTP");
        /* Important: This segment makes a request to the server */
        if (XMLHTTPReq) 
         XMLHTTPReq.open("POST", strURL, false);
         var strResults = XMLHTTPReq.responseText; 
        /* The result that is received from the previous segment is used here */
        if (strResults.toLowerCase() == "true") //true. indicating record exists in Database
         alert("This login already exists. Try another name.");
         document.all.EmpName.selected = true;
         //Everything is cool and can proceed with getting the rest of the details.
      <table cellspacing=0 cellpadding=3 border=1>
       <tr><td colspan=2><CENTER><B>Enter your Login Details</B></CENTER></td></tr>
       <tr><td>Login:</td><td><input type="Text" name="EmpName" value="" onblur="CheckName();"></td></tr>
       <tr><td>Password:</td><td><input type="Text" name="pwd" value=""></td></tr>
       <tr><td>Re-enter Password:</td><td><input type="Text" name="pwd1" value=""></td></tr>
       <tr><td>Qualification:</td><td><input type="Text" name="Qualif" value=""></td></tr>
       <tr><td>Address:</td><td><input type="Text" name="Add" value=""></td></tr>
       <tr><td>City:</td><td><input type="Text" name="City" value=""></td></tr>
       <tr><td>Country:</td><td><input type="Text" name="Country" value=""></td></tr>
       <tr><td colspan=2></td></tr>
       <tr><td colspan=2 align=center><input type="button" value="Submit" onclick="alert('Non-functional!')"></td></tr>
  2. LenoxFinlay

    LenoxFinlay Banned

    You've heard of it. It is the latest buzz term for web programmers these days. AJAX is an acronym that stands for Asynchronous JavaScript and XML. AJAX gains its popularity by allowing data on a page to be dynamically updated without having to make the browser reload the page. I will describe more about how AJAX works, and then go into some sample code to try out.
    This term has been made famous by some of Google's latest web apps. At the top of this list is Google Suggest, which gives you suggestions (go figure) on what you are searching for as you type based on popularity of the search term. If you aren't familiar with Google Suggest, check it out.
  3. shabbir

    shabbir Administrator Staff Member

Share This Page