jQuery Ajax Callback Failing after WordPress 3.0 Update
I have a bunch of jQuery Ajax calls on my WordPress 开发者_JAVA技巧website. After making the update to WP 3.0, I've noticed they aren't working properly anymore.
The PHP server script is getting called, because the action takes place (Ex: deleting a record in a database, which happens successfully). The issue is that the success callback isn't firing. The error callback is firing, and returning "[object XMLHttpRequest]" when I alert the response.
Is there something that has changed with WordPress 3.0? I use the wp_deregister_script and wp_register_script WordPress functions to load the version of jQuery I desire (1.4.2). So, it should still be loading the same jQuery it always has, and ignore the jQuery that comes with WP.
The site is a membership site, so it is hard to show examples, but you can find a page open to the public here... http://www.learnwake.com/requests. Also, the main javascript file that's adding the Ajax functionality for that page can be found here: http://www.learnwake.com/wp-content/themes/learnwake/scripts/requests.js.
Finally got this resolved!
I was including wp-blog-header.php
in my PHP AJAX script. I'm not sure if WP 3.0 changed the way they handle 404's or what, but when I changed the include to wp-load.php
, everything worked, and the WordPress environment that I was using in the script, $wpdb
object and some constants, were still imported and usable.
A better description, and the original answer can be found here: Original StackOverflow Answer
精彩评论