Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jsonp #24

Open
imonly opened this issue Jul 31, 2015 · 0 comments
Open

jsonp #24

imonly opened this issue Jul 31, 2015 · 0 comments

Comments

@imonly
Copy link

imonly commented Jul 31, 2015

Please change jsonp "Content-Type" to "application/javascript"

public $contentTypeJson = 'application/json';
public $contentTypeJsonp = 'application/javascript';

if($jsonp_callback !== null){
$app->response()->header('Content-Type', $this->contentTypeJsonp);
$app->response()->body($jsonp_callback.'('.json_encode($response, $this->encodingOptions).')');
} else {
$app->response()->header('Content-Type', $this->contentTypeJson);
$app->response()->body(json_encode($response, $this->encodingOptions));
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant