Post data not showing at the process script.
I've been having great difficulty with this simple script. From every thing I've read this should work.
$(document).ready(function(){
$(".add_to_profile").css("background-color", "yellow");
$('a.bookmark').click(function (){
var addedbookmark = function (data) {
var divreturn = 'div.return-'+ data.nid;
var divbookmark = 'div.bookmark-'+ data.nid;
$(divreturn).html("bookmark added");
$(divbookmark).html('<a href="remove_bookmark/'+ nid+'" class="bookmark">Remove Bookmark</a>')
$(divreturn).html(nid );
}
$.ajax(this.href,
{
type : 'POST',
dataType : 'json',
success : addedbookmark,
data : "js=1",
});
// return false;
});
});
The important data is sent as a get, and works fine, but I need the post to signal that jQuery sent the data.
<?php
var_dump($_POST);
die;
header('Content-type: application/json');
echo json_encode (array(
'success' => 'added to profile',
'nid' => 95,
));
exit();
All I get is:
array
empty
It would be great if someone could give me a clue.