通过ajax,我想跳转到带有发布数据的filter.php页面,并在filter.php中显示结果

时间:2018-06-27 07:18:57

标签: php json ajax

实际上,我正在制作JSON API数据。 通过AJAX,我希望将数据发送到filter.php并在filter.php上添加Result,因为我希望filter.php中的数据以 JSON格式

这是我的代码。

$.ajax({
        type : "POST",
        data : "id=" + json_data,
        url : "process.php",


        success : function(msg) {
            $(".results__list__wrap").html(msg);

        }

    });  

我可以通过 msg 完美地接收数据,但是我不想在这里得到结果。

1 个答案:

答案 0 :(得分:0)

如果您要发送对象-您做错了。如果希望使用json作为答案,则还应该声明属性“ dataType”。

var d = {id : 1, parameter1: "test", parameter2 : 2123};
$.ajax({
    type : "POST",
    data : d,
    url : "process.php",
    dataType : "json",

    success : function(msg) {
        $(".results__list__wrap").html(msg);

    }

});  
相关问题