Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
PROBLEM Access to files with AJAX
#7
(2017-08-14, 19:20:12)Bigin Wrote: Your controller, a few lines in the functions.php:
PHP Code:
if(!empty($_GET['getPageContent'])) {
    echo 
json_encode(your_function($_GET['getPageContent']));
    exit();


Your processor (could be a function in your functions.php file):
PHP Code:
function your_function($slug) {
    
$data null;
    
$id null;
    
$id lowercase(str_replace('/'''str_replace('..'''$slug)));
    if(
$id) {
        
$data getXml(GSDATAPAGESPATH.$id.'.xml');
    }
 
   return isset($data->content) ? array('content' => (string)$data->content) : null;


I'm trying to tackle something similar to this. I'm wondering if I can pass the slug w/o the controller?
Thanks for any info.
Reply


Messages In This Thread
Access to files with AJAX - by lotova - 2017-08-13, 00:01:46
RE: Access to files with AJAX - by shawn_a - 2017-08-13, 00:47:51
RE: Access to files with AJAX - by Bigin - 2017-08-13, 00:59:37
RE: Access to files with AJAX - by lotova - 2017-08-14, 17:01:47
RE: Access to files with AJAX - by shawn_a - 2017-08-13, 01:02:25
RE: Access to files with AJAX - by Bigin - 2017-08-14, 19:20:12
RE: Access to files with AJAX - by roy_b8te - 2017-08-19, 07:19:23
RE: Access to files with AJAX - by Bigin - 2017-08-19, 16:40:31
RE: Access to files with AJAX - by roy_b8te - 2017-08-19, 17:57:03
RE: Access to files with AJAX - by Bigin - 2017-08-19, 18:25:32
RE: Access to files with AJAX - by roy_b8te - 2017-08-20, 20:49:09
RE: Access to files with AJAX - by shawn_a - 2017-08-20, 05:36:18



Users browsing this thread: 2 Guest(s)