Jeffrey Lang
Jeffrey Lang

Reputation: 192

Update Database without refresh

Im trying to update a database field without refreshing the page

what im using is:

<a class="youtube" href="#" rel="<?php echo $row['link'];?>" title="<?php echo $row['title']; ?>" >
<div class="overlay_play"></div>
</a>

Then i want to update from this video ( they all have unique id's ofc) the field plays

My table looks like this:

id - int(9) title - text link - text plays - int(99)

So in short I have a video list of 6 video's on one page and you can play them in a popup window But what i want is if you click play video that the plays field will be updated

The popup window is done with jquery ( like lightbox ) so i can't refresh the page.

Upvotes: 0

Views: 964

Answers (1)

Duke
Duke

Reputation: 36970

Its easy ,you can do this by using ajax along with php page

if(playbutton pressed) {

   //perform the database operation in through calling a ajax page
   //using jquery post one of them
   $.post('ajax/save.php', function(data) {
      $('.result').html(data);
   });
}

save.php

//Contains all the database operations to save the field

Upvotes: 1

Related Questions