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

    We are writing a custom MODx component to populate some custom tables that have been added to the MODx DB. So far so good. Until now.

    I have a form in the component that needs to load data using an AJAX request. The request happens just fine, but with Friendly URLs enabled, it looks like the result of the AJAX request is the home page(which is what is set up to display when a resource is not found).

    I read a couple of other forum threads that talked about setting up a resource that would serve as the AJAX processor and pass it off to that, but I was hoping that there was a way to bypass MODx's URL rewriting to get to the php page itself.

    Any thoughts would be greatly appreciated.

    Thanks,
    ~Mark
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      You can directly access a .php file in an AJAX request. If it's returning the "not found" MODx page, that means the path to the .php file in your AJAX code is not correct and the file was not found. The web server's rewrite engine won't do any conversion if the file exists at the location specified, so MODx would not get involved.
        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