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!

Link to comment
Share on other sites

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>";
}

?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.