0

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.

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

1 Comment

Found it what i neeeded was $('.youtube-<? echo $row['id'] ;?>').click(function() { $.post("updateplay/save.php?&id=<? echo $row['id'] ;?>"); });

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.