Try this one..
Add this code starting..
<?php
if ($isAjax):
endif;
?>
-- Add this code starting..
<?php
if ($isAjax):
$this->layout = '';endif;
?>
On Fri, Aug 31, 2012 at 4:29 AM, darkangel <luisillo26@gmail.com> wrote:
Did you fix it? I'm facing the same issue :S
On Sunday, July 1, 2012 12:27:27 PM UTC-6, JonStark wrote:--Thanks for the head up !But still, doesn't solve my problem :(Whenever I try to paginate a update just a given div, I get the full layout in response....
Le dimanche 1 juillet 2012 20:18:10 UTC+2, MaJerle.Eu a écrit :just use $this->request->is('ajax')you don't need to include RequestHandler component.OFC, you have to be on 2.x cake that will work this :)<?php echo $this->element('posts'); ?></div>why si "</div>" there ?2012/7/1 JonStarkHello everyone.I'm trying to do a Twitter style auto- load more when scrolling :<?php if (!$isAjax):?><div id="postList">
<?php endif;?>
<?php echo $this->element('posts'); ?></div>
<?php if (!$isAjax):?>
</div>
<?php endif;?>
<?php if (!$isAjax):?>
<?php
echo $this->Html->script('jquery', false);
$maxPage = $this->Paginator->counter('%pages%');
?>
<script type="text/javascript">
var lastX = 0;
var currentX = 0;
var page = 1;
$(window).scroll(function () {
if (page < <?php echo $maxPage;?>) {
currentX = $(window).scrollTop();
if (currentX - lastX > 300 * page) {
lastX = currentX;
page++;
$.get('posts/page:' + page, function(data) {
$('#postList').append(data);
});
}
}
});
</script>
<?php endif;?>
<?php echo $this->Js->writeBuffer(); ?>This should updates only the div "postList" but it returns the whole page in the view. In my controller, I have public $components = array('RequestHandler'); activated, and $this->set('isAjax', $this->RequestHandler->isAjax()); in my function. What am I doing wrong ? Thanks a lot !cake-php+u...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
To unsubscribe from this group, send email to
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
Like Us on FacekBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
No comments:
Post a Comment