This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
    Ben
    
            
            
                    
                                            
        
    
        Hi,
I'm trying to return a page content from an ajax request. for example, I'm in homepage and click some internal link, i want to get from ajax the page object like the twig {% page %}.
 public function onInternalLink(){
 $href =  post('href');
 return [
        'title'=>'', //here i want {{ page.title }}
        'content' => '', //and here {% page %} like this variable in layout.
             ];
     }
 }
my js code is 
  $.request('onInternalLink', {
       data: {href: u}, // var u is the requested url to return
        success: function() {
            console.log('Almost october');
        }
    })
 }
I didn't find a way to get the page object from the php script, is there way to do something like this? Thanks. Ben
Last updated
1-1 of 1