Jump to content

How to call a controller method by ajax


Recommended Posts

I have a controller like this:

 

<?php

 

class ProductControllerCore extends FrontController

{

 

public function setMedia() {

 

parent::setMedia();

 

// Add extra ressources

// CSS

$this->addCSS(...)

$this->addJS(array(...));

 

}

 

// Extra methods

public function renderCart() {

echo '<h2>HELLO</h2>';

}

}

 

And how I call renderCart() through ajax.

I try this:

$.post('./product.php', {'action':'renderCart'}, function(data) {

alert(data);

});

it doesn"t work.

Thanks for your help!

Edited by black_coco (see edit history)
Link to comment
Share on other sites

×
×
  • Create New...