We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 11413
    • 203 Posts
    Hi,

    I’m trying to use a php AJAX framework to build my module, but I still got no result... I tried SAJAX... the requests never got to the server and even when I put it in debug mode, I got no answers to my questions... in fact all got was... nothing.

    then I found AJAX Agent. That framework is developed by people of good reputation and seemed perfectly simple to use. The thing is that the core script file (agent.php) give me an error when loaded in the manager... and I don’t know wich error because it tells me to look at the error log, but there is absolutely no log (and just to know that I needed to check out the logs, I needed to go in the frame’s source code because the error window of the manager was empty and screen wide...)

    I’m about to throw my computer through the window... anyone can give me a hint, or suggest me a simple and effective AJAX framework compatible with PHP4 and MODx?

    Thanks a real LOT in advance!

    Blaise
      Blaise Bernier

      www.medialdesign.com - Solutions for small business, hosting, design and more!
      • 32241
      • 1,495 Posts
      I have no suggestions, due to the fact that I never code using AJAX concept. I’m currently developing an application, and I want it to use AJAX concept as well, so if somebody have a good suggestions, I would love to know about that too wink
        Wendy Novianto
        [font=Verdana]PT DJAMOER Technology Media
        [font=Verdana]Xituz Media
        • 21255
        • 215 Posts
        SAJAX worked quite well for me - I like it because it’s small, simple and it’s javascript calls work fine together with Qooxdoo, which is currently my web-gui of choice wink
          • 11413
          • 203 Posts
          did you use it inside the manager ?? I think it’s causing problems...
            Blaise Bernier

            www.medialdesign.com - Solutions for small business, hosting, design and more!
            • 28042 ☆ A M B ☆
            • 24,524 Posts
            I’m basing all of my AJAX-based module on what I found here:

            http://www.ajaxlessons.com/2006/02/18/ajax-workshop-2-building-tabbed-content/

            and aside from some stupidities on my part, it’s working just fine. I’ve already got the category list taken from the database, and refreshed on clicking a "refresh" icon. It even has a neat little "loading..." tag that works great.

            It uses Prototype, and seems perfectly happy with the version that comes with MODx.

            function getCatList(id) {
            	var url = '../assets/modules/shopx/includes/catlist.php';
            	var pars = 'id=' + id;
            	var myAjax = new Ajax.Request( url, {method: 'get', parameters: pars, onLoading: showLoad, onComplete: showCatList} );
            }
            
            function showCatList (originalRequest) {
            	var newData = originalRequest.responseText;
            	$('load').style.display = 'none';
            	$('catList').innerHTML = newData;
            }
            


            catlist.php just queries the database, creates an unordered list, and prints it. Nothing fancy at all.
              Studying MODX in the desert - http://sottwell.com
              Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
              Join the Slack Community - http://modx.org
              • 11413
              • 203 Posts
              I’ve not tested it yet... but... maybe i’m dumb...

              I was using the ’internal’ method of AjaxAgent and SAJAX that let you call the same page to process the data... as the AJAX call is a separate process, would it be possible that it get stopped because the session information is not available for that process??

              I’m gonna try the ’external’ way of doing and let you know... if it still don’t work, I’m gonna go with Prototype, even if it looks a little more complicated.
                Blaise Bernier

                www.medialdesign.com - Solutions for small business, hosting, design and more!
                • 32241
                • 1,495 Posts
                Quote from: grunt_lord at Mar 06, 2006, 10:06 PM

                I’ve not tested it yet... but... maybe i’m dumb...

                I was using the ’internal’ method of AjaxAgent and SAJAX that let you call the same page to process the data... as the AJAX call is a separate process, would it be possible that it get stopped because the session information is not available for that process??

                I’m gonna try the ’external’ way of doing and let you know... if it still don’t work, I’m gonna go with Prototype, even if it looks a little more complicated.

                I think the only different is, if you’re confident and know a little bit about javascript, then prototype will be the way to go, while if you need an easy to use solution just from the php side, then go with sajax.

                I just got some of my script running using moo.ajax.js. I’m trying the moo.fx.js right now, it’s so nice to have all this lightweight lib that are able to serve enough purpose for my application. I totalled my sample application together with the library is about 10kb. FYI, I’m using P.O.R.K lib as well, due to the fact that it allows easy file uploading grin (I know that using iframe is lame, because it’s not even called ajax wink). Anyway, the point is I can keep the size about 10kb for the script, which I think it’s good enough compare with prorotype.js and script.aculeos grin
                  Wendy Novianto
                  [font=Verdana]PT DJAMOER Technology Media
                  [font=Verdana]Xituz Media
                  • 11413
                  • 203 Posts
                  Ok... so I’ll try with Prototype... I’m not very good at JavaScript but i’ll learn.. I guess it won’t be too long : I did a little bit of Java when I was in school:)

                  bye,

                  Blaise
                    Blaise Bernier

                    www.medialdesign.com - Solutions for small business, hosting, design and more!
                    • 28042 ☆ A M B ☆
                    • 24,524 Posts
                    Oh, dear... can we all repeat together, "Javascript is NOT Java!". If you go into it thinking that it is you will come to serious grief. For one thing, classes are nothing at all like classes in Java. Javascript is ECMAScript with a catchy name. http://en.wikipedia.org/wiki/JavaScript For one thing, it uses a totally different object model.

                    Pay extra attention to the "prototype" concept. (not the Ajax/DOM scripting library!)

                    http://www.crockford.com/javascript/inheritance.html
                      Studying MODX in the desert - http://sottwell.com
                      Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                      Join the Slack Community - http://modx.org
                      • 11413
                      • 203 Posts
                      I know smiley i was talking about the syntax that is the same (almost)... anyway, thank you!

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

                        www.medialdesign.com - Solutions for small business, hosting, design and more!