public static function jsonp($arr) { $callback = request\sanitize::request('callback', 'string'); $output = static::json($arr); if ($callback) { header('Content-Type: text/javascript'); return $callback . '(' . $output . ');'; } else { header('Content-Type: application/x-json'); return $output; } }
public static function isAjax() { return strtolower(request\sanitize::server('HTTP_X_REQUESTED_WITH', 'string')) == 'xmlhttprequest'; }