I'm using jQuery and PHP to record comments. The jQuery part works fine, but I can't get PHP ready to record comments. jQuery returns alert 200 after sending, but I think I can't access to 'class' in PHP.
PHP:
class comments extends config{
public function Action2($id,$comment){
//record comment
}
}
$input=json_decode(file_get_contents('php://input'));
$new_comment=new comments();
$new_comment->Action2($input->id,$input->comment);
jQuery:
$.ajax({
url:'./comment.php',
type:'POST',
dataType:'json',
cache:false,
contentType:false,
processData:false,
data:JSON.stringify({
'comment':comment,
'id':id
}),
});