The Joomla! Forum ™



Forum rules


Please use the mailing list here: http://groups.google.com/group/joomla-dev-general rather than this forum.



Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Thu May 12, 2011 12:11 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Mon May 10, 2010 11:02 am
Posts: 49
Location: Bangladesh
Hi,

Hope everything goes well.

I'm developing a custom joomla 1.6 component. Based on user clicks on a tab I want to display some data through a jQuery Ajax call.

The name of the component is
Quote:
com_pms


Here goes details.....
My jQuery Ajax code: executes/triggers when clicks on a button...
Code:
$.ajax({
         type: 'POST',
          url: 'index.php',
          dataType: 'html',
          data: 'option=com_pms&task=gcompose',
          error: function(xhr, textStatus, errorThrown) {
              alert('An error occurred! ' + errorThrown);
          },
          success: function(data, textStatus) {
             stopSpinner("pms_message_content_compose");
              $(data).appendTo( '#pms_message_content_compose .no-table' );
              lstate_compose = true;
          }
      });


controller.php file contains..
Code:
function gcompose(){
      JRequest::setVar( 'view', 'compose' );
       JRequest::setVar( 'layout', 'form'  );
       parent::display();
   }


views >> compose >> view.html.php
Code:
<?php
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
 
// import Joomla view library
jimport('joomla.application.component.view');
 
class PmsViewCompose extends JView
{
   // Overwriting JView display method
   function display($tpl = null)
   {
      // Display the view
      parent::display($tpl);
   }
}


views >> compose >> tmpl >> form.php
Code:
<?php
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
?>
<div>Some text</div>


I want to display "some text". But instead of this it displays the entire index.php where body contains "some text".

Any idea would be greatly appreciated.. :)

Thanks,
Rashidul


You do not have the required permissions to view the files attached to this post.

_________________
Rashidul
http://www.webcampo.com


Top
 Profile  
 
PostPosted: Thu May 12, 2011 7:33 pm 
Joomla! Enthusiast
Joomla! Enthusiast

Joined: Mon Oct 08, 2007 10:51 pm
Posts: 168
Include "tmpl=component" in the variables in your AJAX POST, or in your URL (as in "index.php?tmpl=component").


Top
 Profile  
 
PostPosted: Thu May 12, 2011 10:16 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Mon May 10, 2010 11:02 am
Posts: 49
Location: Bangladesh
kballou wrote:
Include "tmpl=component" in the variables in your AJAX POST, or in your URL (as in "index.php?tmpl=component").


WOW. it does exactly what i want!!

Many thanks!

_________________
Rashidul
http://www.webcampo.com


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 



Who is online

Users browsing this forum: No registered users and 8 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group