Welcome Guest, Not a member yet? Register   Sign In
REST API webservices
#7

(This post was last modified: 01-23-2016, 01:16 PM by skunkbad.)

(01-22-2016, 05:43 AM)Chandini Wrote: How to send multiple response  using codeigniters RESTful Services
Ex :
$this->response($user_regdata);
$this->response($salary_data);
this way is not working only first response send  ..
How to send multiple responses...  at a time ?


Maybe like this instead:


Code:
$this->response( array( 'reg_data' => $user_regdata, 'salary_data' => $salary_data ) );

Narf just isn't playing mind tricks with you; you only have one response. If you need to pass back multiple "responses", then you need to put them in an object, array, or some kind of container.

BTW, why do this? Many people are so bent on REST, they can't even get anything done. Especially if you're working with jQuery or other JS AJAX, you could just as easily echo some JSON:

Code:
echo json_encode( array( 'reg_data' => $user_regdata, 'salary_data' => $salary_data ) );

... and if you're trying to route requests with REST (because that's all you're really doing), I just think you're wasting your time. It's just an opinion, but remember that you're the one asking questions.
Reply


Messages In This Thread
REST API webservices - by Chandini - 01-22-2016, 05:43 AM
RE: REST API webservices - by Narf - 01-22-2016, 06:48 AM
RE: REST API webservices - by Chandini - 01-22-2016, 11:47 PM
RE: REST API webservices - by Narf - 01-23-2016, 05:39 AM
RE: REST API webservices - by LeMec - 01-23-2016, 10:56 AM
RE: REST API webservices - by Narf - 01-23-2016, 02:02 PM
RE: REST API webservices - by LeMec - 01-23-2016, 03:43 PM
RE: REST API webservices - by skunkbad - 01-23-2016, 04:30 PM
RE: REST API webservices - by LeMec - 01-24-2016, 11:43 AM
RE: REST API webservices - by ciadmin - 01-24-2016, 11:59 AM
RE: REST API webservices - by kenjis - 01-24-2016, 03:12 PM
RE: REST API webservices - by arma7x - 01-23-2016, 12:29 PM
RE: REST API webservices - by skunkbad - 01-23-2016, 01:11 PM
RE: REST API webservices - by kankuro - 01-24-2016, 03:23 AM
RE: REST API webservices - by LeMec - 01-24-2016, 11:25 AM
RE: REST API webservices - by skunkbad - 01-24-2016, 11:51 AM
RE: REST API webservices - by LeMec - 01-24-2016, 11:57 AM
RE: REST API webservices - by Narf - 01-25-2016, 03:54 AM
RE: REST API webservices - by LeMec - 01-24-2016, 12:08 PM
RE: REST API webservices - by LeMec - 01-25-2016, 07:47 AM
RE: REST API webservices - by Narf - 01-25-2016, 08:22 AM
RE: REST API webservices - by LeMec - 01-25-2016, 08:46 AM
RE: REST API webservices - by Narf - 01-25-2016, 09:01 AM
RE: REST API webservices - by LeMec - 01-25-2016, 09:10 AM
RE: REST API webservices - by Chandini - 01-28-2016, 10:55 PM



Theme © iAndrew 2016 - Forum software by © MyBB