I have used jQuery.publish in a number of jQuery scripts now, also it all works fine. But after improving to WordPress 3., it stoped working.

I am focusing on a wordpress plugin where I hve the next jQuery code:

//Delete event and remove from UI
jQuery("#eventList .cancelEvent").live('click', function() {
  jQuery.post("/wp-content/plugins/wp-eventcal/myfile.php", { instance: 'cancelEvent' },
    alert('test');  // Never fires because 404 File Not Found

Firebug reviews a '404 File not found' error. This is actually the link: http://mysite.com/wp-content/plugins/wp-myplugin/myfile.php

Basically copy the hyperlink and paste it into my browser, the page opens all right. No '404 File not found' error.

Searching inside my Apache error log, I begin to see the following error:

Cannot map GET
/wp-content/plugins/I:/Development/wamp/www/norwegianfashion/wp-content/themes/norwegianfashion/images/icon.png HTTP/1.1 to file,
referer: http://norwegianfashion.com/wp-admin/admin.php?page=wp-eventcal/eventcal-manager.php

This really is my Apache config:

LoadModule rewrite_module modules/mod_rewrite.so

NameVirtualHost localhost

<VirtualHost localhost>
    ServerName localhost
    DocumentRoot "I:/Development/wamp/www/"

<VirtualHost localhost>
    ServerName mysite.com
    DocumentRoot I:\Development\wamp\www\mysite

<Directory />
    Options FollowSymLinks
    AllowOverride All

Which is my .htaccess file:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

# END WordPress


Ok, I've simplified it lower for this.

I only obtain the problem after i switch on custom Permalink using /%category%/%postname%.
Basically use default permalink, all works fine.

So again, can it be my .htaccess file?

Just check Apache's error log and you'll see real request path and why it's refused. Probably you unsuccessful with relative road to myfile.php or wordpress is obstructing it.

You may also attempt to set full road to myfile.php inside your JS code.

You sure the URL is correct? It's in accordance with the HTML page, and wordpress' index.php is generally in the same level because the wordpress-content directory. I'd be inclined to suspect therefore the URL ought to be 'wp-content/plug ins/wordpress-eventcal/myfile.php' ?