public function render($view = null, $layout = null)
    {
        $return = parent::render($view, $layout);

        if (!empty($this->viewVars['_jsonp'])) {
            $jsonpParam = $this->viewVars['_jsonp'];
            if ($this->viewVars['_jsonp'] === true) {
                $jsonpParam = 'callback';
            }
            if ($this->request->getQuery($jsonpParam)) {
                $return = sprintf('%s(%s)', h($this->request->getQuery($jsonpParam)), $return);
                $this->response = $this->response->withType('js');
            }
        }

        return $return;
    }
public function render($view = null, $layout = null)
    {
        $return = parent::render($view, $layout);

        if (!empty($this->viewVars['_jsonp'])) {
            $jsonpParam = $this->viewVars['_jsonp'];
            if ($this->viewVars['_jsonp'] === true) {
                $jsonpParam = 'callback';
            }
            if ($this->request->getQuery($jsonpParam)) {
                $return = sprintf('%s(%s)', h($this->request->getQuery($jsonpParam)), $return);
                $this->response = $this->response->withType('js');
            }
        }

        return $return;
    }
public function render ( $ view = null , $ layout = null ) { $ return = parent :: render ( $ view , $ layout ) ; if ( ! empty ( $ this -> viewVars [ '_jsonp' ] ) ) { $ jsonpParam = $ this -> viewVars [ '_jsonp' ] ; if ( $ this -> viewVars [ '_jsonp' ] === true ) { $ jsonpParam = 'callback' ; } if ( $ this -> request -> getQuery ( $ jsonpParam ) ) { $ return = sprintf ( '%s(%s)' , h ( $ this -> request -> getQuery ( $ jsonpParam ) ) , $ return ) ; $ this -> response = $ this -> response -> withType ( 'js' ) ; } } return $ return ; }
Render a JSON view.

### Special parameters
`_serialize` To convert a set of view variables into a JSON response.
Its value can be a string for single variable name or array for multiple
names. If true all view variables will be serialized. It unset normal
view template will be rendered.
`_jsonp` Enables JSONP support and wraps response in callback function
provided in query string.
- Setting it to true enables the default query string parameter "callback".
- Setting it to a string value, uses the provided query string parameter
for finding the JSONP callback name.

@param string|null $view The view being rendered.
@param string|null $layout The layout being rendered.
@return string|null The rendered view.
Render a JSON view .