·  DHTML – AJAX

 

- Info:

  - AJAX stands for Asynchronous JavaSscript And XML.

  - XMLHTTP object represents the core of AJAX.

    It allows you to send requests to server and to receive responses.

    This is done in background withouth reloding the whole page.

    Such response can then be used in any way you want, for instance to change only one part of web page.

  - You can think of AJAX as the most recent addition to DHTML adding new way to comunicate with server.

    But most poeple acctually define DHTML as being part of AJAX.

 

- AJAX Acronym is missleading:

  - AJAX is not Asynchronous.

    Asynchronous comunication ussually means that you send data, and then response comes sometime in the future.

    AJAX sends request to the server and immidately gets response the same way that normal web pages do.

    So asynchronous, in context of AJAX, only means that user can continue to use web page while AJAX

    comunicates with server in the background .

  - AJAX doesn't have to use Java Script since it can be also used with VB Script.

  - AJAX doesn't need XML.

 

- Links:

  http://dhtmlnirvana.com/ajax/ajax_tutorial/

  http://www.telerik.com/community/ajax-learning-resources.aspx?gclid=CIiogp301YkCFRHZXgodF0hyzg

 

- Example:

  - Create C:\Inetpub\wwwroot\client.html and server.asp

  - http://localhost/client.html

 

    client.html

    <input type="text" id="txt1" onkeyup="showHint(this.value)">

    <span  id="txtHint"></span>

    

    <script type="text/javascript">

      function showHint(str) {

        var url="server.asp?name="+str

        xmlHttp=new ActiveXObject("Microsoft.XMLHTTP")

        xmlHttp.onreadystatechange=stateChanged

        xmlHttp.open("GET",url,true)

        xmlHttp.send(null)

      }

    

      function stateChanged() {

        if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") {

          txtHint.innerHTML=xmlHttp.responseText

        }

      }

    </script>

 

    server.asp  (Visual Basic)

    <%

      name = Request.QueryString("name")

      

      result=""

      if name="a" then  result = "Auto"

      if name="b" then  result = "Banana"

    

      Response.Write(result)

    %>