How “Ajax” Works!

In traditional JavaScript coding, if you want to get any information from a database or a file on the server, or send user information to a server, you will have to make an HTML form and GET or POST data to the server. The user will have to click the “Submit” button to send/get the information, wait for the server to respond, and then a new page will load with the results.

Because the server returns a new page each time the user submits input, traditional web applications can run slowly and tend to be less user-friendly. With AJAX, your JavaScript communicates directly with the server, through the JavaScript XMLHttpRequest object.

With an HTTP request, a web page can make a request to, and get a response from a web server, without reloading the page. The user will stay on the same page, and he or she will not notice that scripts request pages, or send data to a server in the background.

This is a simplified introduction about how Ajax works


The user sends a request that executes an action and the action’s response is showed into a layer, identify by an ID, without reload the full page. For example a layer with this id:

<div id=”ajaxResponse”></div>

In the next steps we will see how to create an XMLHttpRequest and receive response from the server.

1. Create XMLhttpRequest

Different browsers use different methods to create the XMLHttpRequest object. Internet Explorer uses an ActiveXObject, while other browsers use the built-in JavaScript object called XMLHttpRequest.

To create this object, and deal with different browsers, we are going to use a “try and catch” statement.

function ajaxFunction()
{
var xmlHttp;
try
{
// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
}
catch (e)
{
// Internet Explorer
try
{
xmlHttp=new ActiveXObject(”Msxml2.XMLHTTP”);
}
catch (e)
{
try
{
xmlHttp=new ActiveXObject(”Microsoft.XMLHTTP”);
}
catch (e)
{
alert(”Your browser does not support AJAX!”);
return false;
}
}
}

2. Sending request to the server

To send off a request to the server, we use the open() method and the send() method.

The open() method takes three arguments. The first argument defines which method to use when sending the request (GET or POST). The second argument specifies the URL of the server-side script. The third argument specifies that the request should be handled asynchronously. The send() method sends the request off to the server.

xmlHttp.open(”GET”,”time.asp”,true);
xmlHttp.send(null);

3. Writing server side script

The responseText will store the data returned from the server. Here we want to send back the current time. The code in “time.asp” looks like this:

<%
response.expires=-1
response.write(time)
%>

4. Consuming the response

Now we need to consume the response received and display it to the user.

xmlHttp.onreadystatechange=function()
{
if(xmlHttp.readyState==4)
{
document.myForm.time.value=xmlHttp.responseText;
}
}
xmlHttp.open(”GET”,”time.asp”,true);
xmlHttp.send(null);
}

5. Complete the code

Now we must decide when the AJAX function should be executed. We will let the function run “behind the scenes” when the user types something in the username text field. The complete code looks like this:

<html>
<body>

<script type=”text/javascript”>
function ajaxFunction()
{
var xmlHttp;
try
{
// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
}
catch (e)
{
// Internet Explorer
try
{
xmlHttp=new ActiveXObject(”Msxml2.XMLHTTP”);
}
catch (e)
{
try
{
xmlHttp=new ActiveXObject(”Microsoft.XMLHTTP”);
}
catch (e)
{
alert(”Your browser does not support AJAX!”);
return false;
}
}
}
xmlHttp.onreadystatechange=function()
{
if(xmlHttp.readyState==4)
{
document.myForm.time.value=xmlHttp.responseText;
}
}
xmlHttp.open(”GET”,”time.asp”,true);
xmlHttp.send(null);
}
</script>
<form name=”myForm”>
Name: <input type=”text”
onkeyup=”ajaxFunction();” name=”username” />
Time: <input type=”text” name=”time” />
</form>
</body>
</html>

Advertisements

Your Way to the Top = Blogging

blogIt is no real secret that a well written topical blog can significantly help out your website – so why aren’t you doing it? 
The most common reasons I hear for not starting a blog involve a lack of time to write posts, and limited ideas to write about, but taking that extra time to get some useful content out there can do wonders for your search rankings among other things. 
An established blog that is updated regularly gets spidered by Google often, and increases the chances of new search rankings considerably. I have seen multiple situations where regularly updated blogs wind up ranking #1 in Google for relevant phrases literally within a couple hours of posting. It usually takes a well established website and blog to make this happen, but there is big potential if you do things the right way. 

blog

It is no real secret that a well written topical blog can significantly help out your website – so why aren’t you doing it? 

The most common reasons I hear for not starting a blog involve a lack of time to write posts, and limited ideas to write about, but taking that extra time to get some useful content out there can do wonders for your search rankings among other things. 

An established blog that is updated regularly gets spidered by Google often, and increases the chances of new search rankings considerably. I have seen multiple situations where regularly updated blogs wind up ranking #1 in Google for relevant phrases literally within a couple hours of posting. It usually takes a well established website and blog to make this happen, but there is big potential if you do things the right way. 

While blogs work best if updated multiple times per week, even those with a new post every week or two have advantages. Blogs don’t have to be a major undertaking, spending only an hour or so a week on posting can have you seeing results in no time. 

bblog

There are many advantages to adding a blog to your website. Here are a few. 

Increased Rankings

By boosting your topical content, you increase the value and relevance of your site. The more new stuff you add, the more of an authority you make your site, and this helps to improve your overall search rankings. It can also help you obtain rankings for “long tailed search phrases”. 

Long tailed search phrases are those that are less commonly searched, and usually exceed 3 or 4 words in length – they are also very targeted to your product or service. Blogs are great for getting rankings on long tailed search phrases. If you see a long tailed search phrase you want to rank for, use the phrase as the post title (if it makes sense to do so) and write a good, content rich post about it and your ranking potential for this phrase will rise.

By writing blog posts with your target phrases in mind, you can often help improve your overall rankings by increasing the relevance of the site to that search phrase. Consider also linking to other relevant pages within your site from the post.

Increased Traffic

Blogs are great for increasing traffic. Aside from the added traffic you may see from search ranking improvements, if your blog is interesting and topical, you will get some repeat visitors to your site as readers check back for new posts. If people really like your blog, they will spread the word, resulting in even more visitors. Just think, have you ever emailed or instant messaged a friend with a link to an article you have read? Don’t you want your link to be the one passed around? 

Credibility

By blogging regularly about your industry you will help to establish yourself as an expert. Many of your potential customers will see your blog and notice that you know what you’re talking about and be more likely to utilize your services. By sharing your knowledge it can help to instill trust onto your visitors which can actually result in increased conversions. There are a lot of faceless, anonymous websites out there – an active blog can help people relate to you and trust you.

Links

A good, well written blog can result in free one way links to your site. Sometimes it is as simple as a fan adding your link to their blog roll, and other times it may be RSS working its magic. Try to squeeze in a link or two into your posts and direct them to other internal pages on your website. If anyone then republishes or syndicates your posts on their sites, you will also end up with a relevant back link. (If you would like some other ideas on link building be sure to check out Ways to Increase Link Density & Building Links with Directory Submissions ) 

A blog is not a magic bullet used to skyrocket your inbound link counts, but it can certainly help. 

What Platform To Use

I am a firm believer in the power of WordPress and the seemingly unlimited plug-ins available to help you. That said, just about any blog platform will work. It is probably best to stick with the main stream providers as they tend to have more options available and better support forums in case you get stuck with customization issues. In the end however, any search friendly blog platform will ultimately do the trick. 

Blog Post Ideas

blog-blogging

If after reading this you are sitting there thinking, “What should I write about?” here are some ideas to help you get going: 

    • New product launches 
    • Press releases
    • Industry relevant news 
    • How to’s related to your product or service 
    • Answers to reader comments 
    • Posts revolving around relevant long tailed phrases 
    • In depth product descriptions or tutorials 
    • Company history or interesting stories 
    • Reviews of related products, services or online tools 

Blogs are relevant for pretty much all industries, and they don’t have to take a lot of your time. A little creativity can help you come up with ideas for posts, just try to think outside the proverbial box.

If you’ve been putting off the blogging idea for some time, consider getting started now. There is much to gain and very little to lose.

Ajax in Action

There are many routes into becoming a JavaScript programmer, ranging from graphic design to a serious programmer coming up from the business tiers.

Live Example: 
http://www.orientalgroup.in/about/hoteldirectory.htm  

What is Joomla™ ?

Joomla is an award-winning content management system (CMS), which enables you to build Web sites and powerful online applications. Many aspects, including its ease-of-use and extensibility, have made Joomla the most popular Web site software available. Best of all, Joomla is an open source solution that is freely available to everyone.


What’s a content management system (CMS)?

A content management system is software that keeps track of every piece of content on your Web site, much like your local public library keeps track of books and stores them. Content can be simple text, photos, music, video, documents, or just about anything you can think of. A major advantage of using a CMS is that it requires almost no technical skill or knowledge to manage. Since the CMS manages all your content, you don’t have to.

What are some real world examples of what Joomla! can do?

Joomla is used all over the world to power Web sites of all shapes and sizes. For example:

  • Corporate Web sites or portals
  • Corporate intranets and extranets
  • Online magazines, newspapers, and publications
  • E-commerce and online reservations
  • Government applications
  • Small business Web sites
  • Non-profit and organizational Web sites
  • Community-based portals
  • School and church Web sites
  • Personal or family homepages
 

Who uses Joomla?

MTV QuizillaHere are just a few examples of Web sites that use Joomla:

More examples of companies using Joomla can be found in the Joomla Site Showcase Forum.

 

I need to build a site for a client. How will Joomla! help me?

Simple Admin interface

Joomla is designed to be easy to install and set up even if you’re not an advanced user. Many Web hosting services offer a single-click install, getting your new site up and running in just a few minutes.Since Joomla is so easy to use, as a Web designer or developer, you can quickly build sites for your clients. Then, with a minimal amount of instruction, you can empower your clients to easily manage their own sites themselves. If your clients need specialized functionality, Joomla is highly extensible and thousands of extensions (most for free under the GPL license) are available in the Joomla Extensions Directory.  

 
%d bloggers like this: