getting data from jquery $.post
Posted: Tue Jul 19, 2011 9:40 am
i have a jquery link to post data to a php script
the problem i have is getting the values for postid and vote in the jquery ajax script and then in the php script
does not work and the $_POST variable is empty in the php script.
Does anyone have any idea how i need to pass the variables in this script so as to populate the $_POST variable in the php script and not the $_GET?
Code: Select all
<a href="ratepost.php" rel="nofollow" class="vote_up_button" onclick="$.post(this.href, {postid: 44, vote: '1'}); return false;" >
Code: Select all
$.click(function() {
$.ajax({
type: 'POST',
url: $(this).attr('href'),
data: ({postid : data.postid, vote : data.vote}),
dataType: 'json',
success: function(data) {
Does anyone have any idea how i need to pass the variables in this script so as to populate the $_POST variable in the php script and not the $_GET?