2013-10-23 66 views
2

我發送一個Ajax請求與相對URL相對URL在PHP

$.post("wp-content/themes/site/function.php", { 

    }, function (data) {}); 

它的工作很好,如果我的網址是http://yourdomain.com/page。但如果網址是http://yourdomain.com/page/

那麼它的發送http://yourdomain.com/page/wp-content/themes/site/function.php。但我想http://yourdomain.com/site/wp-content/themes/function.php

+0

檢查htacess –

+0

做u想要什麼? 'http:// yourdomain.com/site/wp-content/themes/function.php' - >'/ site/wp-content/themes/function.php'與'wp-content/themes/site完全不同/ function.php'。檢查你的程序 – sailingthoms

回答

6

嘗試與一家領先的/

$.post("/wp-content/themes/site/function.php", {}, function (data) {}); 
+1

非常感謝adamb –