The Use Of AJAX Technology Computer Science Essay

Published: Last Edited:

This essay has been submitted by a student. This is not an example of the work written by our professional essay writers.

In order to help customer input information correctly and avoid error happen in uploading meter reading, we should prevent them from uploading a meter reading that is less than the previous reading and not allowing meter readings for invalid dates. In addition, the web page should be able to appear message to notify user what mistake being happen. Furthermore, user would not be able to submit their data before the mistake were clean.

To let the web site have ability to check data and make real time respond, it should use a technology call AJAX (Asynchronous JavaScript and XML). AJAX is a name of a group of technology, include JavaScript, CSS, and XML. It could run on web browser and enhance the interactivity, usability and speed.

JavaScript could be a client side scripting language, developed by Netscape. JavaScript was released since 1996. At that time, it supported Netscape Navigator 2.0 and Internet Explorer 3.0.

XML(Extensible Markup Language) was design to improve data description, storing, and exchanging. It released in 1998 by W3C. Its node concept design and the hierarchical structure provide well support on data storing.

CSS(Cascading Style Sheets) is a Stylesheet language. It is used to separate the data layer and display layer in HTML. On other word, CSS could provide a fixable method to define and format the looking of the web page.

The most important usage of AJAX is using XHR (XMLHttpRequest) to play with web server. A XHR object will be created while user establish connection to web server. The XHR object will happen between web browser and web server. The XHR object will listen to the web servers' update for web page make a partly update. Then XHR will pass the update to the web browser to renew the part of web page. This mechanism successfully decreases the bandwidth using and data processing. AJAX was generally using on interactive web page, such as Google Map, Google search suggestion, and stock price quoting.

In our system, we are going to use JavaScript to do the validation, because JavaScript is a scripting language. JavaScript is able to use function to validate the data that does client input with right data we want. For example, is it input right day, month, and year. In addition, JavaScript could prevent user submit data if data was not meet the system enquired.

Pic 2.2 Create the variable

Firstly, the script in would create a lot of variables that we are going to use (Pic 2.2).

Pic 2.3 The validation function

Then, we will use the function to do the validation (Pic 2.3). On line 19, the code is used to start checking by if loop with the conditions. The code on line 22 alert user "Please select date for meter reading!", if they have not input the day. From line 25 to 41, the function is setup to alert user if they are not input the correct year, month, day, also the meter reading.

Pic 2.4 The validation to the meter reading

From line 52, the JavaScript will check the meter reading input. It will alert if user input the meter reading is less then previous or it is not a number.

Pic 2.5 These code will disable the submit button

From line 120 to 136, the JavaScript will get the result from the script we talk above. If user input wrong data, the submit button will not allow user to press it. If the data is correct, the function will release the submit button. At this time, user will see the text on the button is black, not grey.

Pic 2.6 The submit button

The script from line 147 to 160 is about the submit button. The submit button will play with JavaScript (line 152), to get validate information. Considering there are if the browser could not play with JavaScript, line 155 to 158 allow user see the submit button without JavaScript.

Using the JavaScript, there are some advantage and disadvantage.

On the negative side, there have security and reliability problem. Because JavaScript is run on client computer, it is able be exploited for malicious purposes, Such as: Dead-code insertion, Code Transposition, Register Reassignment... Some user will stop JavaScript running, it will affect the system running.

Beside it, as the result of its portable, it running is fully relied on client side web browser. That means if client browser does not support JavaScript, or has not a new enough version, some script will be failed in running.

Although JavaScript have some weakness, there are many positive feature help it become developers' first choice.

Firstly, JavaScript is not load on server side, that save the running resources and increase server capacity. In other word, client can run JavaScript functions immediately, instead of wait for server reply.

Secondly, JavaScript is relatively simple to learn and implement. It is a open sources high level language, it is easy to implement, compared with other programming language like Python, Perl, C#…

Lastly, JavaScript is a well compatible language. It can insert into web page and other written in other language, like PHP and Perl. It can play with other language for variety of applications nicely.

In Conclusion, AJAX (especially JavaScript and XML) provide our system ability to do validation, which highly decrease the occurrence rate of wrong data. And its compatibility with PHP highly reduces development time cost. Finally, because it run on client side, it directly save server computing resources. It indirectly save administration cost, hardware investment cost and save the development cost.