gpt4 book ai didi

javascript - php中的相对url

转载 作者:行者123 更新时间:2023-11-29 16:14:17 24 4
gpt4 key购买 nike

我正在发送一个带有相对 url 的 ajax 请求

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

}, function (data) {});

如果我的 url 是 http://yourdomain.com/page,它工作正常.但是如果url是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) {});

关于javascript - php中的相对url,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19546957/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com