Siz*_*z S 2 javascript php ajax
我正在发送一个带相对url的ajax请求
$.post("wp-content/themes/site/function.php", {
}, function (data) {});
Run Code Online (Sandbox Code Playgroud)
如果我的网址是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
尝试领先/:
$.post("/wp-content/themes/site/function.php", {}, function (data) {});
Run Code Online (Sandbox Code Playgroud)