Quantcast
Channel:
Viewing all articles
Browse latest Browse all 4235

Re: [SOLVED] Setup an ajax call to load content

$
0
0

Hi Devlin,
I think I've been on the right track but it's not loading the template content into my project-content div for some reason. Does what I have below look correct to you?

In Page.php Controller I have

public function index() {
if(Director::is_ajax()) {
return $this->renderWith("ProductPage");
} else {
return Array();// execution as usual in this case...
}
}


And in the ProductHolder.ss I have

<a href="mypage" onclick="$('#project-content').load( '$URLSegment', function() {});" class="open-project">

I also have this in my Main.js file which might be relevant?

//Portfolio Project Loading
$('.open-project').click(function(){
var projectUrl = $(this).attr("href");

$('#project-content').animate({opacity:0}, 400,function(){
$("#project-content").load(projectUrl);
$('#project-content').delay(400).animate({opacity:1}, 400);
});

//Project Page Open
$('#project-extended').slideUp(600, function(){
$('#project-extended').addClass('open');
$('html, body').animate({ scrollTop: $(".portfolio-bottom").offset().top }, 900);
}).delay(500).slideDown(600,function(){
$('#project-content').fadeIn('slow',function(){
if ($('.project-slider').length > 0) {
initProjectSlider();
}
});
});

return false;

});


Posted to: [SOLVED] Setup an ajax call to load content | Show Thread | Post Reply


Viewing all articles
Browse latest Browse all 4235

Trending Articles