Codeigniter + Angular Js: How to receive JSON data

后端 未结 5 1129
盖世英雄少女心
盖世英雄少女心 2020-12-16 20:24

This is the situation:

I have a simple app made in Angular JS that comunicate with the server through an API made in codeigniter.

There is a

5条回答
  •  时光取名叫无心
    2020-12-16 20:49

    the data sent with the request is a name-value pairs so you should write some thing like that:

    data : {"myformdata":JSON.stringify({email:$scope.user.email, password:$scope.user.password})}
    

    and in code igniter you can recive the data :

    $this->input->post("myformdata"); //should return what
                                      // that JSON.stringify returned
    

提交回复
热议问题