We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 33337
    • 3,975 Posts
    Quote from: grunt_lord at Mar 07, 2006, 02:04 AM

    P.S.: Don’t you ever sleep?? I always get a quick answer from you even if it’s 3AM here :p

    We hustlers don’t sleep, we take naps wink
      Zaigham R - MODX Professional | Skype | Email | Twitter

      Digging the interwebs for #MODX gems and bringing it to you. modx.link
      • 11413
      • 203 Posts
      hahaha!

      You know you,re working hard when you have keyboard prints on your face wink
        Blaise Bernier

        www.medialdesign.com - Solutions for small business, hosting, design and more!
        • 21255
        • 215 Posts
        Quote from: grunt_lord at Mar 06, 2006, 07:01 PM

        did you use it inside the manager ?? I think it’s causing problems...

        Didn’t work for me, too. I guess it’s due to eval... sad Still investigating...

        ...It works (using SAJAX)! wink For some strange kind of reason, you need to set some variables global (had this once before and think it has something to do with includes within functions or eval-statement). The other thing is, that you have to give the correct request_uri (including modx’s arguments) - and better use POST, I guess.

                require($mod_path.'/Sajax.php');
        
                global $sajax_debug_mode;
                global $sajax_request_type;
                global $sajax_remote_uri;
        
                $sajax_debug_mode = 0;
                $sajax_request_type = "POST";
                $sajax_remote_uri = $_SERVER['REQUEST_URI'];
        
                sajax_init();
        
          • 19684
          • 11 Posts
          I am trying sajax, and as you said, I made those variables globals, and it... works.... and maybe POST is better, because I saw that if u set GET, sajax write some header stuff which I don’t really like:P.... maybe because I don’t understand...

          I wrote in the php document of modx:

          $GLOBALS['sajax_request_type'] = "POST";
          $GLOBALS['sajax_debug_mode'] = 0;
          $GLOBALS['sajax_remote_uri'] = sajax_get_my_uri();//$_SERVER['REQUEST_URI'];


          and it worked....

          and I made some modifications to have sajax_target_id variable available from php code exactly as those I mentioned before....

          [tt]sajax_target_id[/tt] was made to put the results of the server ajax function directly in an DOM element, through javascript, but [tt]sajax_target_id[/tt] is not available by default as the others variables.... to set it, you must go to the code of the [tt]sajax_get_common_js()[/tt] function to modify it, and is nasty this way....

          so the modifications are as follows:
          1. in your php code, near the other globals, add the one with [tt]sajax_target_id[/tt]

          $GLOBALS['sajax_request_type'] = "POST";
          $GLOBALS['sajax_debug_mode'] = 0;
          $GLOBALS['sajax_remote_uri'] = sajax_get_my_uri();//$_SERVER['REQUEST_URI'];//$modx->makeUrl($modx->documentIdentifier);
          $GLOBALS['sajax_target_id'] = "";
          



          2. in the Sajax.php add this line, at the beginning of the file, near the other globals:
          $GLOBALS['sajax_target_id'] = "";


          3. in the Sajax.php, in the [tt]sajax_get_common_js()[/tt] function, add this line near the other globals:
          [tt]global $sajax_target_id;[/tt]

          4. in the same function, around line 261, replace [tt]innerHTML[/tt] with [tt]value[/tt] . Mysterious
          reasons, I didn’t understand them, but with [tt]value[/tt] it works.....

          ...and it should work:P