dougu5950 2019-04-12 11:32
浏览 50

运行ajax后我无法从php得到响应

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
    }),
});
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 Vue3 大型图片数据拖动排序
    • ¥15 划分vlan后不通了
    • ¥15 GDI处理通道视频时总是带有白色锯齿
    • ¥20 用雷电模拟器安装百达屋apk一直闪退
    • ¥15 算能科技20240506咨询(拒绝大模型回答)
    • ¥15 自适应 AR 模型 参数估计Matlab程序
    • ¥100 角动量包络面如何用MATLAB绘制
    • ¥15 merge函数占用内存过大
    • ¥15 使用EMD去噪处理RML2016数据集时候的原理
    • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大