showing results for - "codeigniter 3 return json response"
Valentino
18 Jan 2017
1//do the edit in your javascript
2
3$('.signinform').submit(function() { 
4   $(this).ajaxSubmit({ 
5       type : "POST",
6       //set the data type
7       dataType:'json',
8       url: 'index.php/user/signin', // target element(s) to be updated with server response 
9       cache : false,
10       //check this in Firefox browser
11       success : function(response){ console.log(response); alert(response)},
12       error: onFailRegistered
13   });        
14   return false; 
15}); 
16
17
18//controller function
19
20public function signin() {
21    $arr = array('a' => 1, 'b' => 2, 'c' => 3, 'd' => 4, 'e' => 5);    
22
23   //add the header here
24    header('Content-Type: application/json');
25    echo json_encode( $arr );
26}
27
queries leading to this page
codeigniter return json response when client makes post requestreturn json response codeigniter 4return json from codeigniter controllercodeigniter return json response with status codecodeigneter return json datacodeigniter 4 json responsehow to handle json response in codeignitercodeigniter 3 json responsecodeigniter 3 json response objectreturn json response codeigniter 3return json response in codeigniterci json response different from response payloadci return jsoncodeigniter return view with responsereturn json rest response in codeignitercodeigniter return jsonhow to return json object in api response in codeignitercodeigniter 3 json response codereturn only json from codeigniter controllercodeigniter controller return jsonjson encode return in codeigniter controllerhow to set return response json codeigniterhow to return json in codeigniter 2 4codeigniter 3 return json response when client makes post requestclear header in codeignirterrcodeigniter json responsereturn json codeigniter 3codeigniter return json responsecodeigniter response typethis returnjson cireturn json codeignitercodeigniter json requestcodeigniter 3 return jsoncodeigniter response json json response in codeigniterthis response in codeigniterci echo json encode giving response as textreturn json codeigniter 4how to return json response from rest api in codeigniterhow to use response 28 29 codeigniter 3how to get jason response in cihow to print json response in codeignitercodeigniter return json from controllercodeigniter return view as json responsereturn response json codeignitercodeigniter 4 return jsoncodeigniter json returncodeigniter return json viewcodeigniter 4 json requestcodeigniter json 5dhow to return json data cicodeigniter 3 result jsoncodeigniter 3 responsehow to return response in json format in codeigniterjson in codeigniter 24this 3eoutput 3eset output codeigniter 3return data codeigniter as json responsecodeigniter return json to viewcodeigniter api resturn put responsereturn json response codeigniterresponse json codeigniter 3codeigniter 4 result jsoncodeigniter output jsonjson request in codeigniter 4return json in codeignitercodeigniter 3 return json responsecodeigniter 4 request get jsonreturn data codeigniter 4 as json responsecodeigniter 3 return json response