2012-12-14 30 views
-2

嗨即时从我的Joomla组件中的视图做jQuery ajax调用。并需要原始输出。在Joomla中的原始输出

我试图搜索Joomla文档,但找不到任何教程或文档如何使用和实现原始输出。有人有链接或可以告诉我如何为joomla 2.5。

此致的Morten

+0

你应该澄清你的问题的代码。它会帮助其他人了解您的需求.. –

+0

阅读本 - 它应该回答你问题 http://stackoverflow.com/questions/10739611/joomla-component-output-without-html –

回答

0

这是我如何通过AJAX请求数据ID为 'FORMDATA' HTML表单。 我序列从形式的数据,并通过AJAX提交到原始视图,然后我显示原始视图为纯文本的ID为“myformoutput”

<script type="text/javascript"> 
function formupdate() 
{ 
    $.ajax({ 
     type: "POST", 
     url: "index.php?option=com_mycomponent&view=outputview&format=raw", 
     data: $('#formdata').serialize(), 
     cache: false, 
     success: function(html) { 
     $('#myformoutput').html(html); 
     } 

     }); 
} 
</script> 

原始视图一个div内容来自组件com_mycomponent,而视图名称是'outputview'。

'outputview'具有文件view.raw.php而不是view.html.php。它包含:

类mycomponentViewoutputview扩展JView中 {

function display($tpl = null) 
    { 
     echo 'this is raw text'; 
    } 

}