PHP code example of residit / nette-jsonp
1. Go to this page and download the library: Download residit/nette-jsonp library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
residit / nette-jsonp example snippets
namespace App\Presenters;
use Nette,
Residit\Application\Responses\JsonpResponse;
class BasePresenter extends Nette\Application\UI\Presenter {
/**
*
* @param string $callback
* @param string $query
*/
public function actionExampleEndpoint($callback, $query) {
// ...
// do the magic with $query
// ...
$data = array('foo' => 'bar');
$this->sendResponse(new JsonpResponse($callback, $data));
}
}