We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 32241
    • 1,495 Posts
    If that’s the case, you just need to create an independent snippet on MODx. SO basically the snippet will act only as include statement to include the output to MODx page. That will be a lot easier, considering you won’t need MODx API at all. For AJAX, you can look for moo.ajax or prototype. You can choose whichever that suite your needs.

    FYI, there is no pre-made API solution available in MODx to do AJAX processing like SAJAX or other php AJAX framework, but when you started to do it from scratch, you will realize that both of this server side and client side technology are not really connected together, they just work as if they are seamlesly integrated into the system, which most of AJAX framework trying to do. Usually they just add more complexity to the system. It’s just from my opinion though. smiley
      Wendy Novianto
      [font=Verdana]PT DJAMOER Technology Media
      [font=Verdana]Xituz Media
      • 15987
      • 786 Posts
      pierreva,
      If you want to see an example of some ajax working with modx, you can look at the FlexSearchForm with ajax. It uses a snippet to get it all started and then javascript for all of the ajax stuff. One thing you will find is that the api is out of scope once a page is done loading. So you cannot use any of the modx api calls for your ajax requests. So you will need to write some custom way to handle the the request. In the search I used a php page to get the search results and then return them to the ajax request.

      One thing that is neat about modx is that you can use it to output some javascript code to use with your request though. So you can have dynamically created javascript. I use this to output the search options specified in the snippet.

      Here is the snippet:
      http://modxcms.com/forums/index.php/topic,3501.0.html

      Hope that helps.

      Kyle