AJAX
  Home arrow AJAX arrow Page 4 - Ajax Features Needed to Build Active Client Pages
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
VPS Hosting  
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid  
Request Media Kit
Contact Us  
Site Map  
Privacy Policy  
Support  
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
Google.com  
AJAX

Ajax Features Needed to Build Active Client Pages
By: Chrysanthus Forcha
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 4
    2008-10-14


    Table of Contents:
  • Ajax Features Needed to Build Active Client Pages
  • More About the XMLHttpRequest Object
  • The responseText Property
  • Principles of the Ajax Approach

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article

     
     
    ADVERTISEMENT


    Ajax Features Needed to Build Active Client Pages - Principles of the Ajax Approach
    ( Page 4 of 4 )

    Design your first page as you would normally for web design or web development. Let it not be long, so that it will download reasonably fast. This is your master page; it should not have a frameset. It has the store that keeps information necessary for the different pages.

    All of the HTML contents of the first page are in a DIV element. The contents of the pages after the first one (second, third, fourth etc.) are downloaded in advance as texts (strings). When you want a new page, the content of the DIV element is replaced by one of the downloaded strings. When a string is downloaded, it is stored in the store.

    The store is made up of JavaScript variables and/or JavaScript object properties and/or JavaScript arrays. The store should be in the script of the head element of the master page. When the page is downloaded, the size of the store should be small. The store grows as you download more data.

    The Ajax script or function for downloading data (page contents) should be at the bottom of the page; that is, at the bottom of the DIV element. Only the first page comes directly from the server; the rest of the pages are downloaded as text in advance and kept in the store. When a page is needed, your JavaScript code simply replaces the content of the DIV element with the corresponding text from the store. The content of each page can include Ajax download functions. Your script can modify the text before displaying it.

    The script in the HEAD element of the master page should be minimal. If you need more scripts, you can download them by putting an external script tag at the bottom of a page (the DIV) as follows:


    <script src="scriptCode.js"></script>


    The problem here is, when you replace the content of the DIV element, the script that was there will disappear, but you may need it again. Fortunately, there is a way you can add JavaScript statements, functions and objects to the script in the HEAD element by using the JavaScript top level function eval(); this is the subject of a different article, which will explain how you can use Ajax to download text, which will be converted to script.

    With the Ajax Approach, calculations and analysis are done at the client by the overall JavaScript. This lets you design your master page in such a way that the content is rendered as it arrives at the browser.


    I have given you the principles of the Ajax Approach. Let us stop here for now. We continue in the next part of the series.



     
     
    >>> More AJAX Articles          >>> More By Chrysanthus Forcha
     

       

    AJAX ARTICLES

    - PHP AJAX Form Validation
    - Completing a User-Defined CSS Website with P...
    - Create a User-Defined CSS Website with PHP
    - Build A Better Twitter Chat Client Than Cham...
    - Using Division Equations to Make Web Forms S...
    - Using Integer Multiplication to Protect Web ...
    - Using Simple Checksums for Web Form Verifica...
    - Protecting Web Forms with AJAX
    - Using Prototip with AJAX
    - Using Prototip
    - Using the google.load() Method with Google`s...
    - How to Handle Ajax Errors
    - Uncompressing Source Files with Google`s AJA...
    - Using the jQuery Framework with Google`s Aja...
    - Using Google`s Ajax Libraries API




    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 1 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek