Hallo,

ich versuche einen AJAX Call mit json_encode() zu machen.
Bekomme allerdings diese Fehlermeldung:

"missing ) in parenthetical
http://myjoomla/media/system/js/mootools.js
Line 81"


/joomla/components/com_testajax/testajax.php
PHP-Code:
<?php
defined
'_JEXEC' ) or die( 'Restricted access' );
JHTML::_('behavior.mootools');

$path JURI::base();
$com str_replace(JPATH_SITE .'/',"",JPATH_COMPONENT);
$url $path.$com.'/view/view.json.php';

$ajax = <<<EOD
/* <![CDATA[ */
window.addEvent( 'domready', function() {

    var ajaxObj = new Ajax (
        '$url', 
        {
            method: "get"
        }
    );

    ajaxObj.addEvent('onComplete', function (data) {
        var str = Json.evaluate( data );
        document.getElementById('ajax-out').innerHTML = str;
    });

    ajaxObj.request();
    
});
/* ]]> */
EOD;
 
$doc = & JFactory::getDocument();
$doc->addScriptDeclaration$ajax );
?>

<div id="ajax-out"></div>

/joomla/components/com_testajax/view/view.json.php
PHP-Code:
// Set up the data to be sent in the response.
$data = array( 'some data' );
 
// Get the document object.
$document =& JFactory::getDocument();
 
// Set the MIME type for JSON output.
$document->setMimeEncoding'application/json' );
 
// Change the suggested filename.
JResponse::setHeader'Content-Disposition''attachment; filename="'.$view->getName().'.json"' );

// Output the JSON data.
echo json_encode$data ); 

Wäre nett, wenn mir jemand helfen könnte :-)