0

ローカルホストで WordPress を実行していて、ajax を使用してプラグインのファイルから photos.php という別のファイルにリクエストを送信しようとしています。ファイルのアドレスを xmlhttp.open 関数に正しく書きましたが、次のエラーが発生します。

Not Found

The requested URL /wordpress/wp-admin/wp-content/plugins/myphoto/photos.php was not found on this server.

ファイルの実際のアドレスは /wordpress/wp-content/plugins/myphoto/photos.php です。

xmlhttp.open("GET","wp-content/plugins/myphoto/photos.php?c="+option,true);
            xmlhttp.send();
4

1 に答える 1

0

絶対パスを設定してみてください:

xmlhttp.open("GET","/wordpress/wp-content/plugins/myphoto/photos.php?c="+option,true);

エラーは、相対パスを使用していることを意味します。ディレクトリ/wordpress/wp-admin/wp-content...が存在しません。

于 2013-01-19T00:54:58.213 に答える