无法在ajax成功调用中提醒json数据

时间:2017-12-13 09:01:29

标签: angularjs ajax codeigniter

我无法提醒用户的第一个名字

{"id":"4","first_name":"Rupal","last_name":"Pant"}

在角度js中执行此功能后:

在json回复中我得到了:

my php function which return the json value is:
public function Edit(){
    $data = json_decode(file_get_contents("php://input"));
    $id=$data->id;
    $query = "select * from tbl_user where id='".$id."'";
    $check = $this->db->query($query);
    $result = $check->row_array();
    //echo $this->db->last_query();
    echo json_encode($result);
}
{{1}}

问题是,当我收到json响应时,为什么我无法在编辑成功响应之后改变用户名,我在这里做错了,请告诉我。

1 个答案:

答案 0 :(得分:0)

first_name位于response.data对象内。使用response.data.first_name代替

相关问题