2012-12-14 29 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'; 
    } 

}