Return to Snippet

Revision: 72553
at September 19, 2017 17:02 by ravinathdo


Updated Code
<!--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-->

Revision: 72552
at September 19, 2017 16:58 by ravinathdo


Initial Code
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'
		        )));
		}

Initial URL


Initial Description
This code use for get data from php codeigniter controller via angulrJS on view

Initial Title
angularJS: get codeigniter json output

Initial Tags


Initial Language
JavaScript