phpeveryday.com

The best tutorial of php, php framework, php strategies, object oriented oriented,


AJAX: Loading Web Content from Links

Tag: ajax   Category: PHP Basic
post: 27 Dec 2007 read: 2,181


Ajax Tutorial: In this practice, we try build links in page. Then, from that links we call web content. This is basic and simple way to use ajax in our web. From this practice, we can see how ajax works.

We will modify from previous practice. Ok, open test.php, replace with following code:

<html>
<head>
	<SCRIPT language="JavaScript" SRC="ajax.js"></SCRIPT>
</head>
<body onload="callAJAX('home.html','displaydiv')">
<a href="#" onclick="callAJAX('home.html','displaydiv')">Home</a>
<a href="#" onclick="callAJAX('news.html','displaydiv')">News</a>
<a href="#" onclick="callAJAX('about.html','displaydiv')">About</a>
<table>
<tr>
<td id="displaydiv"></td>
</tr>
</table>

</body>
</html>

Create "news.html", enter following test code:

news page test

Create "about.html" enter following test code:

about page test

Now, point your browser to http://localhost/test/ajax/test.php. Try click link.



Series this article:
AJAX : Understanding AJAX
AJAX: Shortcut to AJAX
AJAX: Loading Web Content from Links
AJAX: Loading Preloader Animation Image

| Give Your Opinion | Recommend
Share and Bookmark to: These icons link to social bookmarking sites where readers can share and discover new web pages.
digg del.icio.us technorati Ma.gnolia BlinkList

Recommended articles by other readers:
Web Services: How PHP Kiss VB.NET? (Part 1)
Chart: How to Build Cool Animation Real Time Chart
Joomla: Fast Road to Understand Component Programming
Email: Send Attachement Mail
mod_rewrite - Part 1: create your "fantasy" URL

What do You Think?
Your Name *:
Email *:
(Will not be published)
Website/URL:
Your Comment *:
* Required


615
posting