Welcome to WebmasterWorld Guest from 54.163.65.30

Forum Moderators: open

Message Too Old, No Replies

Life without #refresh

How to surf the web site without complete refresh?

     
9:12 pm on Feb 23, 2009 (gmt 0)

Junior Member

10+ Year Member

joined:Nov 8, 2005
posts:83
votes: 0


Since I had no luck googleing, I have to ask you guys.

How do I make the web site browsing without complete refresh?

We all use Gmail and Facebook. How can I make those links with anchors like, and refresh only some parts of the page (read from php/mysql):

#profile
#inbox
#/photo.php?pid=2272258&id=528532328&ref=nf
etc...

I use HTML, php and mysql.

Thanks!

11:12 pm on Feb 25, 2009 (gmt 0)

Full Member

10+ Year Member

joined:July 6, 2005
posts:215
votes: 0


Its simple ajax, as your a JS beginner, download Prototype.js from Prototype.org simple include it as a javascript above all your other scripts, it handels all the hard parts of ajax for you, then,

your page would look something like this,


<html>
<head>
<title>Ajax Test</title>
<script language='javascript' type='text/javascript' src='./Prototype.js'></script>
</head>
<body>
<div id='ajaxContent' name='ajaxContent'></div>
<a href='./page.php?idx=1' onClick="return ajaxPage(this.href)">Update Page</a>
</body>
</html>

and your ajaxPage() function would look like this,


function ajaxPage(url){
new Ajax.Updater('ajaxContent', url);
return false;
}

That is the bace of ajax, if you want to go further and have your ajax function bookmarkable you will need to learn JS as its a long winded effot that requires about 50 browser work arounds. Prototype should get you started.

 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members