Talking Ajax

Lets say you’re in a club and you ask the barmen for a beer: “Hey, Can i have a cold one?”. The barmen goes to the refrigerator and get you the beer -> Thats AJAX !

Now… lets see how you would go about it without ajax: “Hey, i had a long day at work, my boss doesn’t get off my back, my children hate me and $#^#$^, #$^%^ $&$$ $%^ , can i have a cold one ?, #$^ 3$^#$^, #$^# ………. “.  So the bartender looks at you while he process all the information and tries to understand what did you want from him, After a little while he understands that you want a beer and goes and get it for you.

In other words AJAX is a better, faster and more HUMEN way to let the client (user) talk to the server (This is where you website lives). Let’s look at a more specific example:

The user has a list of tasks which he want to edit, when he clicks edit on a row he can change the data. After it he clicks Save! Well… now the client sends back to the server the changed rows and also the unchanged once – Thats a lot of redundant data. Instead you could just send the id’s of the changed rows and only the data that has been changed. Write your code to work like human interact with one another.

Numbers you said ?

1 char = 2 byte

word is about 6 chars which are 12 bytes

A list of 100 tasks has about 100 rows * 10 word * 12 bytes = 12,000 bytes = 12 kb

12 kb for a single request (without headers and stuff)

Lets sat you have 50,000 users each editing 20 times per day = 12 million kb = 12 Gb of data passed per day. Amazon pricing is $0.12 per Gb so you pay 1.44$ per day which is about 40$ per month for only that page.

Ajax on the other hand will cost you about 1.5$ per month. Thats 26 times more ! so if you pay now about 1000$ per month for bandwidth you could save some money and go get the Beer !

Thanks.