protected function update() {
		
		if(!is_null($this->callback)) {
			
			// Not using application/javascript for compatibility reasons with older browsers.
			$this->headers->set('Content-Type', 'text/javascript');
				
			return $this->setContent(sprintf('/**/%s(%s);', $this->callback, $this->data)); 

		}
		
		// set header only when there is none or when it equals 'text/javascript' (from a previous update with callback)
		// in order to not overwrite a custom definition

		if(!$this->headers->has('Content-Type') || $this->headers->get('Content-Type') === 'text/javascript') {
			$this->headers->set('Content-Type', 'application/json');
		}

		return $this->setContent($this->data);

	}
protected function update() {
		
		if(!is_null($this->callback)) {
			
			// Not using application/javascript for compatibility reasons with older browsers.
			$this->headers->set('Content-Type', 'text/javascript');
				
			return $this->setContent(sprintf('/**/%s(%s);', $this->callback, $this->data)); 

		}
		
		// set header only when there is none or when it equals 'text/javascript' (from a previous update with callback)
		// in order to not overwrite a custom definition

		if(!$this->headers->has('Content-Type') || $this->headers->get('Content-Type') === 'text/javascript') {
			$this->headers->set('Content-Type', 'application/json');
		}

		return $this->setContent($this->data);

	}
protected function update ( ) { if ( ! is_null ( $ this -> callback ) ) { // Not using application/javascript for compatibility reasons with older browsers. $ this -> headers -> set ( 'Content-Type' , 'text/javascript' ) ; return $ this -> setContent ( sprintf ( '/**/%s(%s);' , $ this -> callback , $ this -> data ) ) ; } // set header only when there is none or when it equals 'text/javascript' (from a previous update with callback) // in order to not overwrite a custom definition if ( ! $ this -> headers -> has ( 'Content-Type' ) || $ this -> headers -> get ( 'Content-Type' ) === 'text/javascript' ) { $ this -> headers -> set ( 'Content-Type' , 'application/json' ) ; } return $ this -> setContent ( $ this -> data ) ; }
update content and headers according to the JSON data and a set callback

@return JsonResponse
update content and headers according to the JSON data and a set callback