admin-ajax.php Response Fails When Called from Domain Alias

I’m writing a WordPress plugin that uses AJAX and I had everything setup and working fine for awhile. I came back to the code a few hours later and all of the sudden I was getting a failed response, even though the code hadn’t changed. I got the correct JSON response when I loaded the URL directly in my browser, but when I made the $.post() call Firebug showed the response as completely empty.

It turned out that I had accidentally loaded the site via one of it’s domain aliases when I came back to it instead of using the domain that WordPress is configured with. I’m guessing that triggered the same origin policy and Firefox blocked the response.

2 thoughts on “admin-ajax.php Response Fails When Called from Domain Alias

Leave a Reply

Your email address will not be published. Required fields are marked *