public function setCallback($callback = NULL) {

		if (NULL !== $callback) {

			// taken from http://www.geekality.net/2011/08/03/valid-javascript-identifier/
			$pattern = '/^[$_\p{L}][$_\p{L}\p{Mn}\p{Mc}\p{Nd}\p{Pc}\x{200C}\x{200D}]*+$/u';

			foreach (explode('.', $callback) as $part) {
				if (!preg_match($pattern, $part)) {
					throw new \InvalidArgumentException(sprintf("The callback name '%s' is not valid.", $part));
				}
			}
		}

		$this->callback = $callback;

		return $this->update();

	}
public function setCallback($callback = NULL) {

		if (NULL !== $callback) {

			// taken from http://www.geekality.net/2011/08/03/valid-javascript-identifier/
			$pattern = '/^[$_\p{L}][$_\p{L}\p{Mn}\p{Mc}\p{Nd}\p{Pc}\x{200C}\x{200D}]*+$/u';

			foreach (explode('.', $callback) as $part) {
				if (!preg_match($pattern, $part)) {
					throw new \InvalidArgumentException(sprintf("The callback name '%s' is not valid.", $part));
				}
			}
		}

		$this->callback = $callback;

		return $this->update();

	}
public function setCallback ( $ callback = NULL ) { if ( NULL !== $ callback ) { // taken from http://www.geekality.net/2011/08/03/valid-javascript-identifier/ $ pattern = '/^[$_\p{L}][$_\p{L}\p{Mn}\p{Mc}\p{Nd}\p{Pc}\x{200C}\x{200D}]*+$/u' ; foreach ( explode ( '.' , $ callback ) as $ part ) { if ( ! preg_match ( $ pattern , $ part ) ) { throw new \ InvalidArgumentException ( sprintf ( "The callback name '%s' is not valid." , $ part ) ) ; } } } $ this -> callback = $ callback ; return $ this -> update ( ) ; }
set the JSONP callback
pass NULL for not using a callback

@param string|null $callback

@return JsonResponse

@throws \InvalidArgumentException when callback name is not valid
set the JSONP callback pass NULL for not using a callback