mirror of https://github.com/flightphp/core
parent
3fb62e3884
commit
660fade34f
@ -0,0 +1,13 @@
|
||||
Flight provides support for sending JSON and JSONP responses. To send a JSON response you pass some data to be JSON encoded:
|
||||
|
||||
Flight::json(array('id' => 123));
|
||||
|
||||
For JSONP requests you would use the jsonp method. You can optionally pass in the query parameter name you are using to define your callback function:
|
||||
|
||||
Flight::jsonp(array('id' => 123), 'q');
|
||||
|
||||
So, when making a GET request using ?q=my_func, you should receive the output:
|
||||
|
||||
my_func({"id":123});
|
||||
|
||||
If you don't pass in a query parameter name it will default to **jsonp**.
|
Loading…
Reference in new issue