IT Hardwares

eg: UK or Brides UK or Classical Art or Buy Music or Spirituality
 
eg: UK or Brides UK or Classical Art or Buy Music or Spirituality
 
Business & Money
Technology
Women
Health
Education
Family
Travel
Cars
Entertainment
SD Editorials
Online Guide and article directory site.
Foodeditorials.com
Over 15,000 recipes & editorials on food.
Lyricadvisor.com
Get 100,000 Lyric & Albums.
  • Business & Money
    • A Guide to Business
    • Guide to Finance
    • Ideas for Marketing
    • Legal Guide
    • Guide to Insurance
    • Lettre De Motivation
    • Guide to the Stock Market
    • Human Resource Career
    • Sales Marketing
    • Forex & Trading
    • Advertising & Marketing
    • Startup Guide
  • Technology
    • Guide to Technology
    • Cell Phones
    • Computer Software
    • IT Hardwares
    • Internet
    • Online Security
    • Cameras
    • Search Engine Optimization
    • Science & Technology
  • Women
    • Guide to Women
    • Relationship Advice
    • Marriage
    • Jewelry
    • Pregnancy
    • Fashion Style
    • Divorce Guide
    • Wedding Guide
    • Dating Guide
    • Natural Beauty
  • Health
    • Guide to Health
    • Guide to Medical
    • Plastic Surgery
    • Weight Loss
    • Sports
    • Body Wellness
    • Cancer Treatment
    • Common Illness
    • Health & Lifestyle
  • Education
    • Military Service
    • Politics and Policy
    • Arts & Humanities
    • Education and Teaching
    • Learn Languages
    • Colleges & Universities
  • Family
    • Quality Home Improvement
    • Hobbies and Interests
    • Family Guide to
    • Pet Guide
    • Loans Guide
    • Credit Cards
    • Gardening Guide
    • Home Security
    • Real Estate
    • Home Decor
    • Gift & Present
  • Travel
    • The Travel Guide
    • Adventure Travel
    • Cruise Ships
    • Beach Holiday
    • Travel Accommodation
    • Holiday Destinations
  • Cars
    • Information on Cars
    • Traffic Violations
    • Auto Insurance
    • Trailers
    • Sport Cars
    • The Bikes
  • Entertainment
    • Entertainment Guide
    • World Music
    • Photo & Video
    • Television & Games

How To Create Web2.0 Applications Using AJAX And Clientside HTTP Requests

    View: 
Web2.0 is a term coined to refer to web applications that run without visible page refreshes. A normal website functions by delivering pages of information, with links that allow a user to move from page to page. A web 2.0 application, or AJAX application, runs on a single web page, and uses clientside javascript to initiate and process additional requests to the server. The additional requests run in the background and are invisible to the user; the end result is that the web application appears very similar to a normal computer program, and the user can continue to manipulate the application and application interface without having to wait for the additional requests sent to the server to complete.



AJAX is an acronym that stands for Asynchronous Javascript and XML. The interesting thing about AJAX is that the XML component is actually unnecessary, or rather optional. The important component is asynchronous javascript -- this is the meat of how web2.0 applications work and the XML component is just one possible format for sending and receiving the additional data requests to the server. However, since this processing happens in the background and is invisible to the end user, you can actually build a web2.0 application using any format for the data requests that you wish.

The key to implementing an AJAX web2.0 application is in the XMLHTTP Object. The XMLHTTP objects exists in many forms, both server-side and client-side, and the purpose of it is to allow retrieval and processing of external web pages from within the coding application. Since we are trying to build a client-side web2.0 application, and since Javascript is the most widely available scripting application for web browsers, AJAX is the ideal implementation, and a good cross-browser Javascript code for instantiating the XMLHTTP Object is as follows:

if (document.all) req=new ActiveXObject("Microsoft.XMLHTTP");

else req=new XMLHttpRequest();

When creating a web2.0 application, the idea is that whenever you would normally send data to the server and receive a response in return by submitting a form, or using a link to an external page, instead you implement it by using the XMLHTTP object to send the request or form in the background, and process the resulting data without causing the browser to reload. The XMLHTTP Object allows you to send requests synchronously or asynchronously, but since we are creating an AJAX application you will use asynchronous mode in almost all cases. When submitting form data, you can use either the GET or POST method, but in this article I will show you how to use POST with the XMLHTTP Object as that allows you the widest possible uses.

Once you instantiate the XMLHTTP object, there are four simple commands to creating a web2.0 application. The "onreadystatechange" property is used for asynchronous mode to define a function that is executed whenever the state of the request changes (such as when it completes). The "open" method creates the request and the "send" method send the request. Also, the "setRequestHeader" method is used to specify the format of the data that is being submitted. Here is some example code that shows how a basic AJAX application would work:

if (document.all) req=new ActiveXObject("Microsoft.XMLHTTP");

else req=new XMLHttpRequest();

req.onreadystatechange=ajaxProcess;

req.open('POST','http://'+location.host+'/ajax.asp',true);

req.setRequestHeader('Content-Type','application/x-www-form-urlencoded');

req.send('p1='+escape(p1)+'&p2='+escape(p2));

In this example, "/ajax.asp" is the page that is being retrieved, and "ajaxProcess()" is the function that is executed once the page is retrieved. The variables "p1" and "p2" are sent to the page as form data. You can of course send whatever data you wish according to what you need to do; just make sure that the ajax.asp file processes them correctly and returns the results. Define the ajaxProcess() function so that it processes the returned results, and updates the user interface to indicate that the request has been completed and updates the appropriate variables and/or the user with the new data. If you would like to see an AJAX web2.0 application in action, you can check out the web2.0 RPG I created, Apocalypse, found at www.apocrpg.com .

Using these methods, you can in fact send whatever data you want to the server and process the results, just as if you had used a normal HTTP request. The difference is that when done normally, the end user has to wait for each page to be loaded, which can be unacceptable if the user is on dialup and there are a large number of actions to be performed independently (multiple page reloads). By using AJAX in a web2.0 application, you can execute these actions in the background, and the user never notices the delays as he is able to continue manipulating your user interface while the page requests are processing in the background, invisible.

This type of web application wasn't possible in the past, for two reasons. Primarily, the XMLHTTP object wasn't available until recently, and also Javascript was not widely supported by almost all browsers as it is today. Now that background page requests are possible, it is likely that in the future all web applications will be converted or migrated to web2.0 / clientside AJAX applications. There are also innumerable web applications that simply weren't possible or feasible under the old model, that we will undoubtedly be see appearing in the next few years, that could potentially be very successful. Your website could be one of these, so get started!
More Articles from
Computer Hardware Guide Pg477
Download 300 For Free
Get More Web Site Traffic
Get Out The Way Statik
How To Get A Online Job
How To Get Free High Speed Internet
How To Get Listed On Google
How To Get Online Ps2
How To Get Rid Of Spam
How To Get Rid Of Spyware Free
How To Get Ringtones For Free
How To Get Stuff For Free
How To Make Black Ink
How To Refill Canon Ink Cartridges
How To Start Computer Safe Mode
Promotion Site Targeted Traffic Web
The Best Digital Video Camera
Wide Angle And Telephoto
How To Get More Networking Equipment For Your Dollar
How To Get Repeat Visitors To Your Website
How to Get Quality Backlinks
» More on
Computer Hardware Guide
  • Related Articles
  • Author
  • Most Popular
Lucas Green has sinced written about articles on various topics from Microsoft SQL Server, Computers and The Internet and computers and the internet. . Lucas Green's top article generates over 22200 views. to your Favourites.
Cataract Laser Eye Surgery
If you decide to do the surgery in the outpatient department, it will take longer since more time is needed for surgical preparation as well as recuperation time
 
A Guide to Business | Guide to Technology | Guide to Women | Guide to Health | Family Guide to | Travel & Vacations | Information on Cars

EditorialToday IT Hardwares has 2 sub sections. Such as Computer Guide and Hardware. With over 20,000 authors and writers, we are a well known online resource and editorial services site in United Kingdom, Canada & America . Here, we cover all the major topics from self help guide to A Guide to Business, Guide to Finance, Ideas for Marketing, Legal Guide, Lettre De Motivation, Guide to Insurance, Guide to Health, Guide to Medical, Military Service, Guide to Women, Pet Guide, Politics and Policy , Guide to Technology, The Travel Guide, Information on Cars, Entertainment Guide, Family Guide to, Hobbies and Interests, Quality Home Improvement, Arts & Humanities and many more.
About Editorial Today | Contact Us | Terms of Use | Submit an Article | Our Authors