/ Published in: JavaScript
This code use for get data from php codeigniter controller via angulrJS on view
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<!--Angular http call--> <!--view--> $http({ url: "getSubtype/1", method: "GET", }).then(function (response) { console.log('res'); console.log(response.data); console.log(response.data.a); console.log(response.data.b); }); <!--view--> <!--controlelr--> public function getSubtype($cdsacc) { $arr = array('a' => 1, 'b' => 2, 'c' => 3, 'd' => 4, 'e' => 5); return $this->output ->set_content_type('application/json') ->set_status_header(200) ->set_output(json_encode(array( 'a' => '111', 'b' => '555' ))); } <!--controlelr--> <!--//Angular http call-->