[TYPO3-dev] xaJax update 0.2.3 available

Joerg Schoppet joerg at schoppet.de
Tue Mar 21 18:06:12 CET 2006


Hi Elmar,

I don't get it to work.

here is the code from my ext_pi-class.
<code>
	function main($content, $conf) {
		self::$instance = $this;
		// make first initialization
		$this->initialize($conf);
		
		$this->xajax = new tx_xajax();
		$this->xajax->setCharEncoding('iso-8859-1');
		$this->xajax->setRequestURI(t3lib_div::getIndpEnv('TYPO3_REQUEST_SCRIPT') . '?' . htmlspecialchars(t3lib_div::getIndpEnv('QUERY_STRING')));
		$this->xajax->debugOn();
		$this->xajax->registerFunction(array('tx_jrenmoac_test', &$this, 'test'));
		$this->xajax->processRequests();
		$GLOBALS['TSFE']->additionalHeaderData['joerg'] = $this->xajax->getJavascript(t3lib_extMgm::siteRelPath('xajax'));

		// Decide, which processClass to use, depends on the 'mode'-var
		switch ($this->mode) {
			case 'import':
				$className = 'tx_jrenmoac_process_import';
				break;
			case 'update':
				$className = 'tx_jrenmoac_process_update';
				break;
			case 'showUser':
				$className = 'tx_jrenmoac_process_showuser';
				break;
			case 'showManager':
			$className = 'tx_jrenmoac_process_showmanager';
			break;
		} // switch ($this->mode)

		$this->process = new $className();
		$this->process->vGenerate();
		
		if (is_null(t3lib_div::_GP('xajax'))) {
			$content = $this->process->sGetContent() . '<div id="joerg">joerg</div><a href="#" onclick="xajax_tx_jrenmoac_test(\'sonja\'); return false;">h</a>';

			if (TYPO3_MODE == 'FE') {
				return $this->pi_wrapInBaseClass($content);
			} else {
				return $content;
			} // if (TYPO3_MODE == 'FE')

		} // if (is_null(t3lib_div::_GP('xajax')))

	} // function main($content, $conf)

	public function test($arg)	{
		$sContent = 'test';
		$objResponse = new tx_xajax_response();
		$objResponse->addAssign('joerg', 'innerHTML', $sContent);
		return $objResponse->getXML();
	}

</code>

But everytime I click on my link I get a popup saying "Error: The XML response retrieved from the server was invalid." And I see why, too.
There is the complete page-generation output from typo3. How can I avoid this?

Regards
Joerg Schoppet




More information about the TYPO3-dev mailing list