Hi, I am new to Phalcon and php framework in general. I am having problem building url for calling controller/action through JQuery.
I have a PageController which looks like this:
class PageController extends Phalcon\Mvc\Controller{
public function indexAction($id){
if($id)
echo $id;
}
public function showAction(){
}
}
With index.phtml
<?php
// index.phtml
echo $this->getContent();
?>
<a id="support" href="#">click here</a>
<div class="extend"></div>
and show.phtml
<?php
//show.phtml
echo $this->getContent();
?>
<p> this is show page </p>
and the jquery:
$(document).ready(function(){
$('#support').click(function(e){
e.preventDefault();
$('.extend').load('https://localhost/page/show');
});
});
Yes, it's a simple script. The javascript and JQuery are in different files My current position is in 'https://localhost/page/index' I am trying to load up 'page/show' inside the 'extend' class div in index.phtml file.
The problem I am having is the url inside JQuery.load function. Here's what I've tried so far: $('.extend').load('https://localhost/page/show'); $('.extend').load('<?php echo $this->url->get('page/show'); >?'); $('.extend').load('page/show'); And none of them works. The number 3 works but it's more like the 'page/show' just becomes parameter for indexAction.
Am I missing something here. thanks