Hi all, I am working on a youth group social network site and everything has gone smooth for the most part. Most problems I have been able to solve myself or google came through. This one is above me and google ain't helping! :(
Can I do this during an ajax request from a view script?
<?php if($this->tools):?>
<?=$this->action('postform','content','content',array('type' => 'devotion','targetGroupId' => $this->groupId))?>
<?php endif;?>
//content from database and xhtml rendered here...
I have the /content/content/postform action dynamically creating a post box widget, similar to the one found on facebook. However, I have three slightly different variations I need, so rather than repeating myself, I was simply going to construct the post form and the accompanying javascript using a widget generated from a single internal action request.
Currently I have a news and devotion page using the postformAction() method, located at /content/news/view/ and /content/devotion/view/. The post box is working just lovely when these pages are requested normally. However, when I use ajax the widget doesn't display, only the content directly generated by the called page is displayed. Example, on the news page I get all XHTML and generated content, but no post form. It appears that the request to the postform action isn't even happening.
The Ajax call is coming from /groups/group/view/, using jQuery. I tried both load and $.post and the result has been the same.
//$('#group-content-panel').load('/content/devotion/view/groupId/<?=$group['id']?>');
$.post(
'/content/devotion/view/groupId/<?=$group['id']?>',
{},
function(content){
$('#group-content-panel').append(content);
},
'HTML'
);
Here's to hoping someone has solved this issue, because I am completely stumped. As an FYI, I tested my session variables in the widget and all is working normally, even with the ajax request. It's just that blasted call to $this->action() that is not working.
Your help is appreciated. Thanks.