Why Register With OSV?

Join 5700+ of your peers

Get enriched. Access 1270+ quality tutorials right away on:

  • Joomla 2.5.X, 3.0.X
  • WordPress 3.5.X
  • Shopping Carts
  • E-Commerce Payment Gateways
  • PDFs for each tutorial - FREE for download
  • New topics and tutorials added weekly

FREE EBooks

FREE Templates

Member Login

Not a member yet? Sign Up!

Opensourcevarsity Logo
Tutorials & Training from experienced world class trainers

pdf icons text icons

Display Web Page Content

FOCUS:

  • To refresh HTML content in a webpage without re-loading the webpage
  • The content being picked up from a MySQL database

Let’s build a simple HTML based user interface that will display a list of book titles on the left hand side. When the mouse cursor is placed on any book title, the associated book details will be displayed in the right hand side.

The simple HTML based user interface is as displayed in diagram 1.

diagram1.png
Diagram 1

The codespec that does this is available in displaywebpagecontent.html. Download the codespec of displaywebpagecontent.html.

When the mouse cursor is placed on any of the Book Titles in the left hand side of the webpage as shown in diagram 1, the Javascript method displayBookInfo() populates the right hand side of the user interface with associated Book Details.

Populating the right hand side of the user interface is done using AJAX techniques.

The Ajax Process Workflow Synopsis:

  • The user places the mouse cursor on any Book Title
  • An XMLHttpRequest object is created and configured
  • The XMLHttpRequest object makes a call to the Apache Web Server to run booksinfo.php
  • booksinfo.php accesses the MySQL table bookmaster and returns associated book details
  • The XMLHttpRequest object invokes the callback() function (The listener)
  • The callback() function processes the response received from the Web Server and updates the Javascript DOM
  • The Browser immediately recognizes that Javascript DOM values have changed and updates that section of the HTML webpage which is bound to the Javascript DOM values
  • This immediately displays the information returned in the Browser which catches the user's attention. The entire HTML webpage is not refreshed

When the mouse cursor is placed on any Book Title the following happens:

  • The Background color changes to a light yellow
  • The right hand side section of the webpage is populated with the following information
  • Publisher Name
  • Book Image
  • Book Cost
  • Book Synopsis

as shown in diagram 2.

diagram2.png
Diagram 2

The Javascript code that populates the right hand side is available in ajaxfunctions.js. Download the codespec of ajaxfunctions.js

The complete codespec can be downloaded from above.


We love Your Comments

What keeps you awake at night?
Do let us know.
We will try our best to deliver tutorials that will help you sleep much better.

Smileys

:confused: :cool: :cry: :laugh: :lol: :normal: :blush: :rolleyes: :sad: :shocked: :sick: :sleeping: :smile: :surprised: :tongue: :unsure: :whistle: :wink: 

  5000 Characters left

Antispam Refresh image Case insensitive

 

Download tutorials free

The tutorials at have been written by by passionate teachers who have been using open source tools and technologies for years.

Real time images of their development screens are generously used throughout each tutorial.

Download the tutorials to your desktop as PDFs for ready reference whenever you need

Download Free Templates

Free Templates

Give us your comments

Give us your comments or feedback on any of our tutorials.

Your comments help us deliver the best possible training modules.

Is there a specific tutorial you want written? Just Ask.

All Open source tutorials

Apache (10)    |   PHP (40)    |   MySQL(70)    |   JavaScript (40)    |   Ajax (20)    |   SEM (20)    |   SEO (20)

CONNECT WITH US

Sitemap   |   Privacy Policy   |   MySQL(70)   |   Disclaimer   |   Reach Out To Us
Designed by Ivan Bayross & Meher Bala | Powered by Joomla
© 2013 All Rights Reserved.