Ajax

Permalink
how to configure ajax in single pages ?

 
WillemAnchor replied on at Permalink Reply
WillemAnchor
I think I've answered this question before...anyways here are some snippets.
In your view, the url you need looks like:
$.ajax({   // get the stack options (buttons)
               dataType:   "html",
               type:         "post",
               url:         "<?php echo $this->action('your_function') ?>",
               data:         {
// your data
               },
               success:      function(result) {
                  if (result) {
                  }
               }
            })


In your controller:
public function your_function() {  // Note that the action_ prefix is not needed here.
// get your data if any
// return html (note: json datatype may be needed for other data)
   echo('<h1>loud and clear</h1>');
   exit;
}
MrKDilkington replied on at Permalink Reply
MrKDilkington
Until the 5.7 AJAX documentation is available, this might be a good opportunity for creating example AJAX packages.

A packaged block and packaged dashboard single page. Both would include very simple uses of AJAX and a lot of code comments.

I know a lot of people would benefit from it.
WillemAnchor replied on at Permalink Reply
WillemAnchor
I still will....sooon ! :D