Improved online shop
You can use Ajax to make better traditional Web-applications, simplifying interactions between the server and the client, limiting perezagruzki pages. To show it, I use a simple example of a basket of the buyer for online of shop which is dynamically updated when products are added in it{her}. Applied in online - shop, this reception could allow to continue to users search and addition of products in their baskets without expectation after each pressing when the whole page will be updated. While some lines of a code of this clause{article} are characteristic for an example of a basket of the buyer, illustrated technics{technical equipment} it is possible to apply to any application Ajax. Listing 1 shows code HTML for cases of an example of a basket of the buyer. I shall come back to this code HTML during clause{article}.
Listing 1. The important fragments of an example of a basket of the buyer
<! - the Table of products of the catalogue of shop, in line on a product->
<th> Name </th> <th> Description </th> <th> Price </th> <th> </th>
...
<tr>
<! - Details of products->
<td> Hat </td> <td> Stylish bowler hat </td> <td> $19.99 </td>
<td>
<! - Press the button to add a product in a basket with the help of search Ajax->
<button onclick = " addToCart ('hat001') "> Add to Cart </button>
</td>
</tr>
...
<! - Performance of a basket of the buyer updated asynchronously->
<ul id = "cart-contents">
<! - the List of products will increase for each product in a basket->
</ul>
<! - the Total cost of the products shown inside an element span->
Total cost: <span id = "total"> $0.00 </span>

|