本文介绍了jQuery.load给了我一个404未在WPMU中找到的信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经开发了一个插件,该插件可以在单个站点WP上正常工作.
但是在带有子域的WPMU上进行测试时,出现了404 Not Found错误.

I've developed a plugin that works fine on a single site WP.
But when testing it on WPMU with subdomain, I get a 404 Not Found error.

奇怪的是,即使我收到错误消息,内容也已加载-但从未显示该内容.

The strange thing is that the content is loaded even though I get the error message - but the content is never displayed.

您可以在此处查看屏幕截图:
http://www.stiengenterprises.com/download/tmp/jQuery_load_error.png

You can see a screenshot here:
http://www.stiengenterprises.com/download/tmp/jQuery_load_error.png

jQuery代码如下:

The jQuery code looks like this:

  jQuery.post("/wp-content/plugins/wp-eventcal/eventcal_jquery.php", { instance: 'getEvent', eventID: eventID },
  function(event)
  {
    alert(event); // For testing - never fires

  }, "json");

关于如何解决此问题的任何建议?

Any suggestions to how I can fix this?

.htaccess

# BEGIN WordPress

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]

# uploaded files
RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]

# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule  ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule  ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]

# END WordPress

推荐答案

之所以会出现此问题,是因为您的eventcal_jquery.php未包含在Wordpress框架中,因此,当它被调用时,wp返回404.在包含wp之后只需包含header('HTTP/1.1 200 OK');您的eventcal_jquery.php

This problem happens because your eventcal_jquery.php is not included to the Wordpress framework, so when it called, wp returns 404. Just include header('HTTP/1.1 200 OK'); after including wp-blog-header.php in your eventcal_jquery.php

这篇关于jQuery.load给了我一个404未在WPMU中找到的信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 20:04