Reading list Switch to dark mode

    Opencart Ajax

    Updated 31 May 2016

    Opencart Ajax – Using Ajax we can call our controller function and load data without refreshing page.For this we have to create a function in our controller file like and you can call it using ajax.

    //in your controller file your ajax function
    public function Ajaxcall(){
    $json = array();
    if(isset($this->request->post['call']) AND isset($this->request->post['data'])){
    $data = $this->request->post['data'];
    $call= $this->request->post['call'];
    $result = $this->model_module_wkajax_demo->yourModelFunction($data,$call);
    $json['success'] = $text_main;
    //in your .tpl file after any event use ajax to call controller function
    type: 'post',
    url: 'index.php?route=module/wkajax_demo/Ajaxcall',
    //add data like this using &
    data: 'call='+Ajax+'&data='+YourData,
    dataType: 'json',
    success: function(json) {
    if(json['success']) {
    //you can use data according to need

    Searching for an experienced
    Opencart Company ?
    Find out More
    . . .

    Leave a Comment

    Your email address will not be published. Required fields are marked*


  • Su Ahmed
    • Nikhil Chaudhary
      • Su Ahmed
        • Vikhyat Sharma
  • Back to Top

    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home