I need to make a like/dislike section using jquery and html so I have this code:
$('#like').mousedown(function() {
var name = $('#like').val();
$.post('php/vote_movie.php', { like: name }, function(data) {
$('#like_feedback').html(data);
});
});
all works well if I manually type the url like vote_movie.php/movie_id=22
for example.
but I need the url to update itself because in php I use $_GET['movie_id']
url for the vote page so jquery needs to take that id from url and match-it with $_GET['movie_id']
from vote_movie.php
basically I need something like this:
$('#like').mousedown(function() {
var name = $('#like').val();
$.post('php/vote_movie.php?movie_id=<$_GET['movie_id']>', { like: name }, function(data) {
$('#like_feedback').html(data);
});
});
and I have no idea how to do it because I'm a newbie in both php and java.
Any help on how to achieve this will be greatly appreciated.
Thank you.
Update:
to a better understanding here are my files:
likes.js http://pastebin.com/FnVFrDZX
watch_movie.php http://pastebin.com/QVScXZCd
vote_movie.php http://pastebin.com/g70xbvsf