• ericr23

    (@ericr23)


    Our website has a WordPress blog in a subdirectory. On the site’s home page, a basic ajax routine (XMLHttpRequest) loads the latest posts into the sidebar. Well, it did until our VPS host moved us to a new host, even thought the environment is virtually identical (Linux Apache 2.2, PHP 5).

    Another ajax call to a photo gallery (Coppermine) still works. I have tried every possible path as well as a call to a php file in the home directory to then load the WordPress script. The WordPress script itself still works fine if directly loaded in the browser. If its extension is changed from “php” to “txt”, the file (unprocessed) is loaded by ajax. If the ajax script is moved to reside in the WordPress directory, it still does not work.

    So there appears to be something now preventing WordPress from running the script when called by ajax. The script in the WordPress directory uses $wpdb->get_results("SELECT wposts.* FROM $wpdb->posts ...

    What might be causing this failure?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter ericr23

    (@ericr23)

    I just tried using jQuery instead, with the same result.

    Thread Starter ericr23

    (@ericr23)

    Using Firebug, I discovered that even though the script was loading it was being returned with a 404 (file not found) response, which led to me to try changing “require(‘wp-blog-header.php’);” to “require(‘wp-load.php’);”. That has apparently both fixed the incorrect header response and restored ajax functionality.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Ajax calls to WordPress stopped working after move to new host’ is closed to new replies.