In this chapter, there are some treatment about the beginning of Ajax that consist of the debut to Ajax, the background of Ajax, and how does Ajax procedure in order to briefly explicate what are Ajax in order to go on to the following chapter of the execution of Ajax. The execution of Ajax will discourse about how does Ajax being implement such as execution in application and interface design. The undermentioned chapter will be the treatment of the pros and cons of the Ajax because every engineering will hold their ain pros and cons so in the chapter 3, there are some pros and cons with the given illustrations in order to do it clearer.
Ajax besides every bit known as AsynchronousA JavaScriptA andA XML is a technique used in client-side to developing an synergistic Web application with a combination of several engineerings. The first engineering is including usage of HTML or XHTML and CSS for presentation. Second engineering is for dynamic show and interaction with the page through Document Object Model ( DOM ) , while 3rd engineering is the usage of XML and XSLT for the informations interchange.
Fourth engineering is the use of XMLHttpRequest object for asynchronous informations retrieval and the last engineering is the most of import engineering that is JavaScript that playing a function to associate all these engineerings together ( Stamey and Richardson, 2006, pg282 ) .
Harmonizing to Fu et Al. ( 2010, pg567 ) in twelvemonth 2004, Ajax web application such Gmail and Google Suggest is become popular and its referred to Web 2.
0 applications, since these web application are more synergistic and the manner of planing is more dynamic that are similar to desktop application.
Before the execution of Ajax, Web page is a strictly server-side application, users interact with an hypertext markup language page, the hypertext transfer protocol petition will direct to the waiter and so the waiter will update its province and direct a response to the client with a new hypertext markup language page, server calculate a new hypertext markup language page may take some clip. Besides that, clean page will be displayed to the user while waiting for the waiter response, and this will do the user unable to do any interaction with the web page and each clip of the petition are require the page to be refresh. Ajax page are dependent with the client-side JavaScript including the usage of JavaScript and Ajax library constituents such as squeeze box, jazz band box, tab saloon and etc Fu et Al. ( 2010, pg567 ) .
An illustration on how does the Ajax work in form entry is, after user fill up the signifier and so snap on submit button, the browser will get down running an event managing to roll up all the information from the page. After that, it will direct an asynchronous XmlHttpRequest ( XHR ) with a respond animal trainer recall map that had specified. While waiting for the response, the browser does non expose a clean page for reviewing intent, and the page are still remain and user are still able to interact with the page. The page ‘s province will be partly update after the response animal trainer receives the waiter ‘s response ( Modelworks Software, 2005 ) .
Another illustration from Modelworks Software ( 2005 ) is a canvass in an Ajax page. User can vote either Cats or Dogs based on the Figure 1.3.1 and the consequence will expose in a saloon chart after chink the ballot button.
Figure 1.3.1
Figure 1.3.2 AJAX sequence diagram
The Figure 1.3.2 from Modelworks Software ( 2005 ) shows how the XMLHttpRequest is being used. The AJAX procedure starts with a DOM event. Then, client demand to obtain an XMLHttpRequest object in measure 1, and after user make choice of either Cats or Dogs, so snap on Vote button in Figure 1.3.1. After acquire the XMLHttpRequest object in measure 1, ‘onreadystatechange ‘ recall is working and naming the ‘open ‘ and ‘send ‘ method. By utilizing the XMLHttpRequest object, any format of informations can be send and receive yet it can be other than XML. JSON are recommended to utilize because it is a subset of the field object notation in JavaScript that contains many characteristics of XML. When directing the XMLHttpRequest to server, the application should give the user some ocular indicant that something has changed in order to avoid confusion. In this illustration, “ Vote ” button had changed to “ Loading… ” as shown in Figure 1.3.3.
Figure 1.3.3
In measure 2, server need to hold a animal trainer to treat the petition and the animal trainer can be a Common Gateway InterfaceA ( CGI ) or other server-side book such as JSP, PHP and etc. These server-side books can be the animal trainer to treat the petition, and in measure 3, client-side demands to treat the response from waiter. While waiting for the consequence, user are still enable to interact with the page. At the terminal of measure 3, the page ‘s province will partly update, and the canvass consequence will expose in Figure 1.3.4.
Figure 1.3.4
THE IMPLEMENTATION OF AJAX
In this chapter, we will discourse about how to construct a good Ajax application. The illustration that is being used in this chapter for treatment is the look intoing on the username in a user enrollment.
To plan an Ajax application, foremost at all we need to specify a JavaScript map in the Web page for event handling. The event animal trainer map is used to direct an asynchronous HTTP petition utilizing the XMLHttpRequest object. The XMLHttpRequest object created by the JavaScript is used to raise with server-side plan. In this illustration, username will be send to the waiter as petition parametric quantity ( Lerner, 2006 ) .
Second is to make a server-side plan by utilizing any linguistic communication other than JavaScript. The Server-side plan will have the HTTP petition with parametric quantities from client-side and so will bring forth HTTP response in any Multipurpose Internet Mail ExtensionsA ( MIME ) format, XML, plain text and JSON ( JavaScript Object Notation ) . In this illustration, server-side plan will utilize the username parametric quantity and execute look intoing with the database to seek whether the username is already bing or non. The consequence will return in XML ( Lerner, 2006 ) .
Last, a Callback JavaScript map that must be defines in the user ‘s Web browser in order to manage the informations response from waiter ( Lerner, 2006 ) .
POST, is another type of petition that are infixing the parametric quantities into the petition organic structure. By utilizing POST, there are no restriction on the parametric quantity ‘s length for both names and values, and the URL will be cleaner. By utilizing other petition such as GET petition, the URL ‘s entire size will hold restriction by a batch of browsers. Post are easier to implement and much more unafraid compared to Get petition because the creative activity of POST petition is much harder than the creative activity of a GET petition.
The cryptography below shows that the xhr.open parametric quantities is being POST and indicating a plan that will make the dynamic ouput coevals. Besides that, for the 3rd parametric quantity, it is the scene of the question in background, which is asynchronously to be true value by informing XMLHttpRequest object.
map checkUsername ( ) {
// Send the HTTP petition
xhr.open ( “ POST ” , “ /cgi-bin/check-name-exists.pl ” , true ) ;
xhr.onreadystatechange = parseResponse ;
volt-ampere username = document.forms [ 0 ] .username.value ;
xhr.send ( “ username=”” + flight ( username ) ) ;
Besides client-side, server-side plan is besides playing an of import function in Ajax application. This is because server-side is the plan that could interact with database for informations exchange in order to do answer to the client side. Besides that, server-side is a concealed plan from user that will execute all the activities of checking, validate, accept, and answer petition that are sent from client-side application ( Lerner, 2006 ) .
# ! /usr/local/bin/perl
usage strict ;
usage nosologies ;
usage warnings ;
usage CGI ;
usage CGI: :Carp ;
# Define the usernames that are taken
# ( Use a hash for lookup efficiency )
my % usernames = ( ‘abc ‘ = & gt ; 1,
‘def ‘ = & gt ; 1,
‘ghi ‘ = & gt ; 1,
‘jkl ‘ = & gt ; 1 ) ;
my $ query = new CGI ;
print $ query- & gt ; heading ( “ text/plain ” ) ;
# Get the POST informations
my $ postdata = $ query- & gt ; param ( “ POSTDATA ” ) ;
# Get the username
my ( $ name, $ value ) = disconnected /=/ , $ postdata ;
my $ username=”” ;
if ( $ name eq ‘username ‘ )
$ username = $ value ;
# If this username is defined, say “ yes ” !
if ( exists $ usernames { $ username } )
print “ yes ” ;
# Otherwise, say “ no ” !
else
print “ no ” ;
The server-side plan can be written in other programming linguistic communication ; the illustration in the Listing 2.1.3.1 is a simple Common Gateway InterfaceA CGI plan that is written in Perl. Look at the POSTDATA parametric quantity, this is the informations received from the Ajax petition. In this server-side plan, if there is a petition of username, this plan will seeking for the matching among the keys of the % usernames hash, if it is matched, a ‘yes ‘ value will be return to the company, while if it is non match, so ‘no ‘ value will be returned ( Lerner, 2006 ) .
Listing 2.1.3.1 check-name-exists.pl
When the response arrives from the waiter, the parseResponse map [ Listing 2.1.4.1 ] will be called. The parseResponse map is called for every individual alterations of the readyState belongings of the XMLHttpRequest object. There are values from 0 to 4 for the readyState belongings which are ‘0=UNINITIALIZED, 1=LOADING, 2=LOADED, 3=INTERACTIVE, 4=COMPLETED ‘ . The value of 4 in the readyState belongings mean that having the response from the waiter is completed and the response information is available through belongingss of the XMLHttpRequest object. The belongings value of readyState are required to hold four times alterations in order to make the completion, which is from Loading to COMPLETED, that the parseResponse map gets called for four times for each response. In order to guarantee that the information is available in the XMLHttpRequest object, the belongings comparing of value ‘4 ‘ will be made to the xhr.readyState belongings in the map of parseResponse ( Potturi, 2005 ) [ Listing 2.1.4.1 ] .
If the readyState of the XMLHttpRequest instanceA has a value of ‘4 ‘ , so necessitate to checkA its position belongings to do certain that a valid response was received. The position belongings holds the codification of the HTTP position that is returned from the waiter. A value of 200 agencies that the informations received in the petition is OK. Work sharing for both client and waiter is the key for a good Ajax application. In this illustration, we used exchange statement to seek at the different responses from waiter ( Potturi, 2005 ) [ Listing 2.1.3.1 ] .
First at wholly, if the response is yes, so the submit button for the signifier will be disable and will expose a warning message indicate that the username was taken. The submit button will re-enabled and the warning message will be removed when user change the username inside the text field. Besides that, if the response is no, which mean the username is available, so the submit button will enable and the warning message will be removed. Furthermore, if the response is empty, so this instance will be disregarding, and eventually, if the response is an unexpected information, an unexpected response qui vive will motivate. Look at the parseResponse map ( Lerner, 2006 ) [ Listing 2.1.4.1 ] .
volt-ampere xhr = getXMLHttpRequest ( ) ;
map parseResponse ( ) {
// Get variables ready
volt-ampere response = “ ” ;
volt-ampere new_username = document.forms [ 0 ] .username.value ;
volt-ampere warning = document.getElementById ( “ warning ” ) ;
var submit_button = document.getElementById ( “ submit-button ” ) ;
// Wait for the HTTP response
if ( xhr.readyState == 4 ) {
if ( xhr.status == 200 ) {
response = xhr.responseText ;
switch ( response )
instance “ yes ” :
setText ( warning,
“ Warning: username ‘ ” +
new_username + ” ‘ was taken! “ ) ;
submit_button.disabled = true ;
interruption ;
instance “ no ” :
removeText ( warning ) ;
submit_button.disabled = false ;
interruption ;
instance “ ” :
interruption ;
default:
qui vive ( “ Unexpected response ‘ ” + response + “ ‘ ” ) ;
else
qui vive ( “ job: xhr.status = “ + xhr.status ) ;
Listing 2.1.4.1 post-ajax-register.html
Use of a combination of asynchronous JavaScript, the Document Object Model ( DOM ) , CSS and XMLHttpRequest AJAX enables faster, more antiphonal Web applications. A Dynamic HTML-based Web application is a Web interface interior decorators that can do fast, synergistic, animated, and increased updates to a user interface without reviewing the full Web page ( Wroblewski, 2005 ) .
Previous web applications used frames or iframe to hold certain elements on a page updated. But with Ajax, any component defined with DOM can be extremely dynamic, and informations can be buffered from the background without user action. The information is readily available whenever the user needs it ( Wroblewski, 2005 ) .
Since Ajax allow all the elements within a Web page to be changed separately and rapidly without impacting the remainder of the page, non most of the Web user are acquire common with it. The Ajax-based updates are really fast user may non detect the alterations of the page. Therefore, in order to catch an attending to user, some techniques can be use. Two common attacks to advise user the interface alteration are colour alteration and life ( Wroblewski, 2005 ) .
The usage of colour alteration merely like when informations on peculiar subdivision is updated, that subdivision is colour is changed to bespeak the informations alteration. In order to acquiring the attending from user efficaciously, the colour used must be contrast with the remainder of interface. The gesture of an life is besides attractive to user ( Wroblewski, 2005 ) .
The usage of life is to allow user cognize that the waiter is process some response to their action. The life can be a loading circle or saloon and etc. Animation besides can utilize to decelerate down the interface update to do certain user is notice it. This attack is great, but if user did non detect the alteration is made, user may presume no responsive is given ( Wroblewski, 2005 ) .
ADVANTAGES AND DISADVANTAGES OF AJAX
By utilizing Ajax, there are many advantages and there are some of the major advantages. First at all Ajax is cut downing the web latency job and better user interactivity with the application interface compared with traditional page-based Web design. Google Maps is an illustration where the refresh latency job is solved ( Zucker, 2007 ) .
When user are utilizing Google Maps application and hunt for a peculiar location, the maps will be displayed in a frame shown in Figure 3.1.1. Download-refresh paradigm is applied in old map application, which are when user hunt for a peculiar location, a map image is displayed as one page, and the page is required to review when user pan or rapid climb the map image hence user demand to wait for the web page to get the information from waiter. But for the Ajax-enabled map application, Google Maps let user to catch the map and drag it and the map frame will filled with informations fluidly without reviewing the page shown in Figure 3.1.2.
The information is being buffered and lies outside the boundary line of the map in frame before user need it so when user dragged the map, there is no refresh latency, and the pre-fetched informations will be displayed in the frame. User interacts with Ajax page is more likely desktop application feels because there is no page refresh. User request a information and the informations are carried asynchronously at a different clip.
Figure 3.1.1 and Figure 3.1.2 is allocated on following page.
Figure 3.1.1 searched consequence of Sri Aman
Figure 3.1.2 image from Figure3.1.1 being rapid climb in.
Similar to Gmail, alternatively of pre-fetching informations, Gmail is more dressed ores on Ajax to supply application interaction and there is non full active show will necessitate to review. In old type of email application, the page will be refreshed when a new electronic mail arrives, but with the execution of Ajax, merely the peculiar subdivision demands to be refreshed. The design of Gmail is more like a desktop application, when a new emails arrives, the full page will non be refresh, the electronic mail will added automatically to the inbox so that user no demand to press the refresh button to see the new electronic mail and this will better user interactivity ( Zucker, 2007 ) .
Besides cut downing the web latency job and better user interactivity, other advantages by utilizing Ajax-style scheduling is less Bandwidth demands. This is because merely the requested information from user will be transferred and merely the peculiar subdivision will necessitate being refreshed, while user are still can interact with the page. This will besides take down the ingestion of the waiter ‘s resources ( Zucker, 2007 ) .
Besides that, dynamic informations filtering could work will with Ajax. Example like T-shirt telling application, when users select a peculiar size of a shirt, it will filtrate out the available coloring material for the selected size of the T-shirt and each choice do non necessitate the page refresh ( Zucker, 2007 ) .
Last, Ajax besides recommended utilizing in signifier entries. Each proof checking can be done before user submitted the signifier. For illustration, a member enrollment signifier, when user enter the watchword, the application will look into whether the watchword is fulfil the application demand or non and so intimation to user when it does non carry through the demand ( Zucker, 2007 ) .
The major disadvantages of utilizing Ajax in a web page are when user bookmarks a web page. Users are confused when unfastened the bookmarked Ajax page, the page may get down at first get downing point of the Ajax page but non the page the user desired. The solution to get the better of this job is the books of making a bookmark Cam dynamically add a section to the URL to maintain the province information. So user can return to the page that they are desired ( Zucker, 2007 ) .
For illustration, in SHISEIDO web site, when user go through the farther stairss such as seeking group of merchandise based on the classs as shown in Figure 3.2.1, and book marked it. The following clip when user is unfastened the bookmark, the same location as Figure 3.2.1 is non being shown, while the page being shown is in Figure 3.2.2 due to the book marker does merely hive away the URL reference of the page user breaker alternatively of hive awaying both reference and the location where user book marked it.
Figure 3.2.1
Figure 3.2.2
Besides that, another disadvantages when using Ajax in a web page is when user imperativeness the back button on the browser, the browser may confound the user, it will take user back to the old page alternatively of the old measure within the application. Google maps have overcome this job by utilizing the book to infix the information into the browser history list, so when user presses the back button, the application is return to the old measure within the application ( Zucker, 2007 ) .
Besides, Ajax is dependence on JavaScript. Not all the browser can back up JavaScript illustration like Ajax is non suited for planing nomadic application because nomadic browser do non back up JavaScript. Again, the execution of JavaScript is different in assorted browsers, illustration like Google Chrome, Firefox, Internet Explorer and etc ( Kanjilal, 2010 ) .
With the execution of Ajax, the length of the codification will increase and this will be hard to debug and may do of the security menace ( Kanjilal, 2010 ) .
CRITICAL EVALUATION
In my concluding twelvemonth undertaking I am making a tegument attention gross revenues system which consists of two applications, which are frontend and back-end applications. Both of the applications are utilizing C # programming linguistic communication to implement. Besides, these two applications are Web-based application.
The frontend system is an unfastened public web application to the cyberspace. Many users will try to utilize this application. So the design of the application must be attractive plenty to pull the user. Therefore I use Ajax for the user interface designing. For illustration, a brassy bill of fare saloon used in frontend system. There is some life when user moves the mouse hover on the bill of fare.
Furthermore, kind able tabular array usage in both of the application the intent is I can screen the tabular array without page refreshes. A flexible and extensile day of the month chooser is applied in day of the month field, so that user can take to choose the day of the month from the day of the month chooser or manually enter in to the text field and so Accordion will be use as side bill of fare saloon, when users select on the bill of fare heading, it will skid and the bomber faculty will expose in the panel for user to choose. These Ajax constituents applied in both of the application in my concluding twelvemonth undertaking.
Besides, I used tooltip as a aid tool in both of my applications every bit good, when mouse over a symbol like ‘ ? ‘ , some aid information will expose to the user inside a panel. Others Ajax constituent like grid, tab saloon, Carousel and combo box may besides used into my applications.
For my back-end system, Ajax is applied in gross revenues, stock list and care faculties. The intent it to do the application more like a desktop application, do it possible to less page refreshing. Beside that implement Ajax into my back-end system can increase the user interactivity and cut down the web latency by less of page refreshing.
Ajax applied in maintains stock list, member, staff and provider faculty which is insert and update. The intent is to formalize the user input and intimations to the user. For illustration, infix a new staff record. If user input invalid electronic mail reference, it will give a intimation to user how is the illustration of a valid electronic mail reference without reviewing the page.
For the gross revenues faculty, the page is non necessitate to review when a new point it added into the order list, merely the order list will be updated. If there is a page refreshing require for each new point added in the user may thwart when utilizing this application.
For my frontend system, Ajax is applied in member, provider, reserve, on-line gross revenues and payment faculties.
In member faculty, Ajax applied in member enrollment signifier and update member inside informations signifier. The intent is to formalize user input and intimations to user. For illustration, when user enter their username, it will look into whether the username is available or non and will give user the intimation. Besides that, if user does non make full in the compulsory field, it will give user a intimation every bit good. After user filled up the signifier with a validate information and imperativeness the submit button, the web page will treat the signifier entry. After done the enrollment procedure, the page will non review and merely the enrollment signifier country will be updated.
For the provider faculty, Ajax is used for proof intent that is applied in provider inside informations signifier. For illustration, when provider input an invalid electronic mail reference, it will give supplier a intimation how is the illustration of a valid electronic mail reference without reviewing the page.
For the reserve faculty, in measure 1 after user had selected a day of the month for intervention, it will expose the clip agenda of the selected day of the month. And so user can choose the available clip and procedure to the measure 2 which in fill up the reserve inside informations form. From stairss 1 to step 2 there are no require page reviewing with the execution of Ajax.
For the on-line gross revenues faculty, Carousel is applied in this faculty which user can scroll and see the merchandise, in other manner to see the big image without reviewing the page. Besides that, user can take to see the merchandise in a grid position or table position every bit good.
In my sentiment, Ajax is good for execution in Web-based application. The ground why usage Ajax is because it is fast response and it communicate with server-side asynchronously, the waiter merely process the informations require by the client brand and so direct back to the client. Besides, it buffering the information before the client requires it, so client no demands to direct the petition to the waiter when they need the information. Furthermore client can portion the waiter work load, there are many things can be done in client side. For illustration signifier proof can make in client side before it uploads to the waiter.
Another ground why usage Ajax, is because it is a good interior decorator for Web-based application. Ajax is powerful and it can do a Web-based application expression and feel like a desktop application. Because reviewing full page is non require by an Ajax page, merely portion of the page are require reloaded when it get so response from the waiter.
Ajax do truly supply us the benefit for user interaction decrease the traffic of web, yet merely require simple surveies in order to implement it. Besides of simple surveies, the codification are easy to understand and execution. I do strongly back up the use of Ajax because it brings a batch of benefit to user.
From what I read from those article that written in mentions chapter, with the execution of Ajax, it do assist in bettering the web site engineering with commanding the informations exchange by executing the information transmittal for those necessary informations merely alternatively of whole page informations transmittal.
Decision
As the decision, the engineerings of Ajax is a good engineerings that used to better the designing of application and interface due to the system to make asynchronously in term of interaction between user and the system.
Although Ajax has some disadvantages but the advantages for utilizing Ajax is more than the disadvantages and that is the ground why a batch of web applications are utilizing Ajax in the web site. Ajax can cut down the web latency and this could enable the application to execute faster to better user experience when utilizing it. Besides that, user can hold more interaction with the web page in term of Ajax are refresh and procedure the necessary country of the page alternatively the whole page.
With the advantages that overcome the disadvantages, Ajax is strongly supported to utilize because by utilizing Ajax, it improves user satisfaction by utilizing the web site due to the desktop-like application by the execution of Ajax.
Appendix
Essay Writing Service Features
Our Experience
No matter how complex your assignment is, we can find the right professional for your specific task. Contact Essay is an essay writing company that hires only the smartest minds to help you with your projects. Our expertise allows us to provide students with high-quality academic writing, editing & proofreading services.Free Features
Free revision policy
$10Free bibliography & reference
$8Free title page
$8Free formatting
$8How Our Essay Writing Service Works
First, you will need to complete an order form. It's not difficult but, in case there is anything you find not to be clear, you may always call us so that we can guide you through it. On the order form, you will need to include some basic information concerning your order: subject, topic, number of pages, etc. We also encourage our clients to upload any relevant information or sources that will help.
Complete the order formOnce we have all the information and instructions that we need, we select the most suitable writer for your assignment. While everything seems to be clear, the writer, who has complete knowledge of the subject, may need clarification from you. It is at that point that you would receive a call or email from us.
Writer’s assignmentAs soon as the writer has finished, it will be delivered both to the website and to your email address so that you will not miss it. If your deadline is close at hand, we will place a call to you to make sure that you receive the paper on time.
Completing the order and download