public function _jsonp(
        $data,
        $param = 'jsonp',
        $code = 200,
        $encode = true,
        $charset = 'utf-8',
        $option = 0
    ) {
        $json = ($encode) ? json_encode($data, $option) : $data;

        $callback = $this->request()->query[$param];

        $this->response()
            ->status($code)
            ->header('Content-Type', 'application/javascript; charset='.$charset)
            ->write($callback.'('.$json.');')
            ->send();
    }
public function _jsonp(
        $data,
        $param = 'jsonp',
        $code = 200,
        $encode = true,
        $charset = 'utf-8',
        $option = 0
    ) {
        $json = ($encode) ? json_encode($data, $option) : $data;

        $callback = $this->request()->query[$param];

        $this->response()
            ->status($code)
            ->header('Content-Type', 'application/javascript; charset='.$charset)
            ->write($callback.'('.$json.');')
            ->send();
    }
public function _jsonp ( $ data , $ param = 'jsonp' , $ code = 200 , $ encode = true , $ charset = 'utf-8' , $ option = 0 ) { $ json = ( $ encode ) ? json_encode ( $ data , $ option ) : $ data ; $ callback = $ this -> request ( ) -> query [ $ param ] ; $ this -> response ( ) -> status ( $ code ) -> header ( 'Content-Type' , 'application/javascript; charset=' . $ charset ) -> write ( $ callback . '(' . $ json . ');' ) -> send ( ) ; }
Sends a JSONP response.

@param mixed $data JSON data
@param string $param Query parameter that specifies the callback name.
@param int $code HTTP status code
@param bool $encode Whether to perform JSON encoding
@param string $charset Charset
@param int $option Bitmask Json constant such as JSON_HEX_QUOT
@throws \Exception
Sends a JSONP response .