Jump to content

Update database without refresh or going to another page


peterbz

Recommended Posts

I've noticed that in many sites such as YouTube and Facebook, they have features such as Add to Friends or Add to Favourites which automatically updates their database without refresh or going to another page.  For example, when I click on ADD TO FAVOURITES in YouTube, it doesn't require refreshing of pages and it just dynamically pops up a box underneath the button that says "This video has been added to your favourties"

 

I was just wondering how this can be accomplished.  How would you update information to the database and dynamically re-populating information/layout on the page without refreshing?  Does this require AJAX?  If so, what would I need for scripting with AJAX?  Does it require additional support or do servers that can run PHP already have the capabilities to run AJAX (please don't mind me if what I'm saying doesn't really make sense as I have no knowledge of what AJAX really does).

 

Any help would be appreciated.  Thank you for your time!

So AJAX is basically Javascript talking to PHP or other server-side language?

 

Can you please give me a sample or beginner tutorial similar to how the example I stated earlier can be accomplished?

 

Thanks for your help!

 

...

http://members.aol.com/barryaandrew/xmlhttp/article.html

 

There's a sample AJAX app in my sig

Here a php way for you.........

 

<?php

$friends_name="redarrow";

$x="Your friend $friends_name name has been added <br> Thank you";

echo"<a href='".$_SERVER['PHP_SELF']."?enter=go&friends_name=$friends_name'>Add A Friend</a>";

if($_GET['enter']=="go"){

//update the database

echo " <br><br>$x<br><br>";
}

?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.