Made in USA: Enterprise Application Services

Ringing PhoneCall Today!817-210-4042

Ajax Magic How to Trick People in Thinking Your Website Is a Program

Ajax Magic How to Trick People in Thinking Your Website Is a Program

August 11, 2009
|
0 Comments
|

The internet has become our future, becoming such a huge part of your lives. You wouldn’t be here reading this without it, as well as many other things that we take for granted in our lives like checking email, social networking, ordering food, and more. But for all the people that use the internet every day, only a few of us know the drawback to the internet: you must ask to receive.

It is this drawback that shapes most of the websites you read today: A server creates the HTML page that is sent to your computer. While we can stream movies and music to our websites, everything stays static. If anything is supposed to change on the website, your browser needs to ask for a new page by refreshing. But this either requires the website programmer to build some loop to constantly refresh the page (causing a very ugly flicker) or the user would have to refresh the page themselves.

But now us programmers have a magical toolbox to get around this issue, called AJAX. With AJAX you can have a page update itself without the user even knowing. You can have information change, actions updated, all with a smooth flow and no flicker! People visiting your website will feel that they are interacting with a program, never knowing that you are just being sneaky with your web pages. With a little practice and learning, even you can fool every person on the internet! Just let me show you how!

Removing the Refresh

The AJAX toolkit comes as a standard inside the toolbox of your Microsoft Visual Studio, and it is really easy to use. Just take the Update Panel inside the AJAX Extensions and wrap it around any section you want AJAX to be applied to. Now whenever a person visiting your website and clicks on a button or link that changes the content inside of the AJAX panel, it happens automatically. No page flicker, no standard refresh, just quickly changed information just as if your website was a program itself.

What is happening behind the scenes is the AJAX Panel is calling for a refresh of the page, but only the section that is within the panel itself. Since this amount of information is much smaller usually, it is able to quickly check for new information and update it on the screen without needing to touch the code for any other part of the page. The new updated HTML is matched up with the old HTML and the page changes right in front of their eyes.

Timers – Getting a Website to Move on its Own

Unfortunately, the AJAX Update Panel needs to be told “Hey, check for new information please.” This can still require a person to interact with the page, pressing some type of button or link to display new information onto the page. But what if you have some services or programs running behind the scenes updating information? How would you update this new information without having users click on a button or link?

Introducing the AJAX Timer, a simple and easy control to be used with your AJAX Update Panels. Just toss in an AJAX Timer and an AJAX Script Manager inside the bounds of the AJAX Update Panel and you have everything you need to handle this. When an AJAX Timer is used, you can choose to give it some time of timing duration (6 seconds for example). Then as a visitor is on a webpage with an AJAX Timer, the Update Panel will go and see if there is new information every time the Timer reaches a new interval. Want the information to be updated every 20 or more seconds? Just tell the timer how long you want it to wait. Do you want the updates to be fast? Just set your timer to half a second and it will look just like an active program! And all that you need to do is drop 2-3 controls from your toolbox onto your page.

Living Outside the .Net

But don’t think that AJAX is only for Microsoft products, as AJAX can be used with nearly any technology out there! If you can use Javascript and ASP, you can use AJAX. But without using Microsoft’s easy controls and components, there is a bit more work for you to do. First you must know Javascript, XML, HTML, and CSS. Secondly, you need to learn more of the technical details about what AJAX is doing behind the scenes since it is constantly running back to the server asking, “Is it ready yet? Is it ready yet?” Understanding how this code works requires basic fundamental knowledge of Javascript, so I would stick to Microsoft’s AJAX toolbox if you are still new to the ways of the net.

If you want to know more about AJAX, whether it is more in-depth information about what is going on behind the scenes or how to use it without any Microsoft products, just surf on over to www.w3schools.com for a quick tutorial. In 30-45 minutes, you’ll know everything there is to making your website smooth and polished. But most important, you will trick every visitor to your site thinking they are using a program. Welcome to the new millennium!

Related Posts