|
Why Does Ajax is Such a Wonderful Tool?
Tags: Ajax Programming Server Client JavaScript Facebook ASP 10/3/2008 I always heared about Ajax, but never really got to understand what this means. Is it a language? is it a library? is it a component? well, it seems that it`s a trick. A JavaScript trick. But before I start explaining what I want to say, let me explain the problem on hand, that Ajax is solving here: Until 2005, it was common that in order to get information from the server, it was needed to load a new page that will be generated by the server through whatever server-side language you chose to work with. It was a problem for big sites: Should the user wait until the whole page reloads just to see a little update? So the people there in the programming industry remembered a little trick they knew, a client-side one, called XMLHttpRequest (it existed before, because the functions are supported also in Internet Explorer 5.5 and FireFox 1.0). They said: Maybe, instead of reloading the page everytime we want to update the content, we will update an outer page, hidden from the public (apart from the punks that try to look at the source code) that will be updated by the administrator`s will (with or without an admin GUI to handle SQL databases or not, it doesn`t matter) and then we will display the published content. There was much rejoicing. But before I explain to you all how Ajax works, and why it is so wonderful tool to work with, I would like to raise a discussion here: I know it will sound fullish, but hey, it was an initial idea: Before I`ve even heared about Ajax, I wanted to make the component myself, so I can update my pages and still the user that already loaded the page, would see the change in it. So what I did was this: We has a wonderful and nice tool to fix bugs with that is called Buffer. What does the buffer do? The buffer is loading all the page`s code into itself, and if turned on, the page will be displayed to the client only after the page finishes to load. Which is splendid if you do not want your users to see bits of images and styles before they are ready to be viewed in the way they really should look like. BUT, when you turn the buffer off, the page will load and be displayed to the user as it builds itself. So I thought to myself: Why don`t we take this option, and manipulate it: make the page stuck in an infinite loop, that reads from a source (application,session,txt file or a database) every X times and while the page runs, try to edit the content. And guess what: It worked! The content was changed instantly, without the need to refresh the page. The problem was: The server was stuck each time I did it. Means: no use. So let`s go back to Ajax. Ajax does it all in the client-side, so it has two advantages: 1. If something`s stuck, it`s the browser, and not the whole server 2. With me working in ASP, I prefer working with Strings with JavaScript rather than VBScript. So basically, Ajax is only a client-side component that existed in JavaScript for a long time and just sat there waiting to be discovered. Yes, you hear it well, again, a client side. And you won`t believe it, even the code is easy! So, I sat up and drawed this nice diagram to make it easyer for you all to understand what the hell I`m talking about: ![]() It`s a little messed up, so I will explain. Technicaly, what we want to acheive is a real-time content update. So we start off with building the server-side page, that will be updated according to our request (I work currently with GET, becuase it`s faster). So, we create the server side page, which give Ajax another advantage upon working with databases with client-side languages only (if it was possible): All the connections information such as database user, password, name, address etc are kept hidden. After the page is proccesed in the outer page, the Ajax gets it`s request back and gets the entire HTML code. Next thing we patch it up with JavaScript and DOM to fit the information to the right place, add some CSS on the way (it never hurt anyone) and finally, everything is read as pure HTML by the browser. Isn`t it wonderful? I really was impressed by Ajax, really. And that is why I think it`s a wonderful component. The only problem that it comes in handy only in real-time browser-based games, catalogs and a really large database manipulation (i.e. Google Suggest and Facebook. They use it alot.). I hope you understood what I tried to say here and thought it was interesting. I am open for comments, for anything you want to say, complain and correct. Thank you, and take care :) Comments
#1
Name: Figantoa123 (5/17/2010) eMail: yumatu817213@gmail.com Title: yabanci sarki sozleri sarki sozu sozler akor cetveli senin o gozlerin varya sozler akor bm sarki sozu
#2
Name: Figantoa123 (5/18/2010) eMail: yumatu817213@gmail.com Title: gitar akord sozler akorlar yolcu yolunda gerek akor tum sehir agladi akor senin o gozlerin varya sarki sozleri
#3
Name: Figantoa123 (5/18/2010) eMail: yumatu817213@gmail.com Title: grup 84 gitar akorlari sarki sozleri sevdan bir ates akoru rock sarki sozleri elektro sozler akor
#4
Name: ezxgzfbv (6/10/2010) eMail: zxmkzmqm@jilapqpk.com Title: ezxgzfbv [URL=http://yuktunfr.com]tqkcwvzw[/URL] qevwgrex vaieuibv http://cbsutese.com oddqzjvn hiegnbuu
#5
Name: osamaelsafory100100 (7/6/2010) eMail: digitalsportwatches@mytop-in.net Title: digitalsportwatches This is another great product form Timex. This baby has it all, and I am completely in love with it. Here is a nutshell review of the zone trainer: http://digg.com/users/sheritjackson -
#6
Name: grenlick (7/6/2010) eMail: djbson44@gmail.com Title: grenlick 89DVZf http://www.xy73BsUuiapvk2nbv83nMmc7p.net
#7
Name: muziaurd (7/26/2010) eMail: klhfbsyd@zxixsrkz.com Title: muziaurd tiwgupdu qfpjqxgs http://nqdmzhaj.com tglmdlvw eufilqgo [URL=http://sreuxhuj.com]vasdpfdq[/URL]
#8
Name: samanta (8/31/2010) eMail: clublive47@hotmail.com Title: samanta ORhaPh http://djb3jDdmjckow30cnjcmd61l0dy.com |
Search
Archive October 08 November 08 December 08 January 09 February 09 March 09 April 09 May 09 June 09 July 09 August 09 September 09 January 09 February 09 March 09 April 09 May 09 June 09 July 09 August 09 September 09 Keywords ASP (4) Programming (3) SQL (3) Ajax (2) Domain (2) Design (1) Creativity (1) Server (1) Client (1) JavaScript (1) Facebook (1) Project (1) Links W3schools |