Jump to content

Call font controller with AJAX

Angel Moral

Recommended Posts

I have a file named nadie.tpl whose driver is NadieController.php, I want it to use a controller function through AJAX. The problem is in the introduction of the url in the AJAX query that does not work for me, it was tested so that nobody, nobody.php, NadieController, NadieController.ph, etc.

nadie.tp (Location: themes / classics / templates)

{extends file='page.tpl'}
{block name='page_title'}
<span class="sitemap-title">{l s='Plantilla descargable' d='Shop.Theme'}</span>
{block name='page_content_container'}
<p><label>Introduce ancho:</label> <input type="text" id="name" name="name" maxlength="8" size="10" /></p>
<p><label>Introduce alto:</label> <input type="text" id="name" name="name" maxlength="8" size="10" /></p>
<button onclick="myFunction()">Click me</button>

<p id="demo"></p>

function myFunction() {
  console.log("Entro myfuncion");
                type: 'POST',
                data: {action:'getPDF'},
                url: i dont know how to call NadieController.php,
                success: function (response) {


NadieController.php (Ubicación: controllers/fronts)

class NadieControllerCore extends FrontController

public $php_self = 'nadie';

public function initContent()
if(isset($_POST['action']) && !empty($_POST['action'])) {
    echo "<script>console.log( 'Entro IF' );</script>";
    $action = $_POST['action'];
    switch($action) {
        case 'getPDF' : getPDF();break;
        // ...etc...



public static function getPDF(){
$pdf = new FPDF('P','mm',array(20,10));



Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...