Ajax and jQuery
There are several methods that come with jQuery that you can use to make what we like to refer to as Ajax calls. The most complete one is, not surprisingly, called .ajax()
. We will start with a simple one.
Many Ajax-based sites are like that—an omnipresent menu on top, some other navigation in a footer at the bottom, and a center piece with constantly changing content. We cannot stress early enough that when we use Ajax the way we describe here, and our website is called index.php
, no matter how often the content of the center piece changes, our current web page will still be index.php
.
So, let's assume that we have a website with a main menu on top, and some basic content in the middle, inside a <div>
with the id varicontent
. It does not really matter what is inside #varicontent
on the initial load—it is typically a nice photo banner—this is the chapter that explains what goes on when we change its content and replace it with something different.
jQuery Ajax methods
We...