$.ajax({
type: "POST",
url: "/bbr-category-configuration",
data: "category_data",
dataType: "json",
success: function (response){
console.log(response);
}
});我在console.log中测试我的ajax表单

它说404没有找到,但我想可以肯定,我错过了完整的路径,所以我补充道:
url: "clinical/bbr-category-configuration",这一次,路径通过我的clinical文件夹的两倍,在下一个屏幕截图。

这是怎么回事?(目录添加了两次)
发布于 2021-06-17 06:08:55
您定义的是url的绝对和相对路径。
在JS或html文件中,如果您使用/urlPath将/请求重定向到任何url,那么您的重定向/请求将从基本url(http://example.com/urlPath)开始。
使用简单的锚元素可以看到这种行为。只要将这些放在html文件中,您就会看到结果。
<a href="clinical/bbr-category-configuration">Redirects from the current path</a>
<a href="/clinical/bbr-category-configuration">Redirects from the base url path</a>上面的clinical/bbr-category-configuration将从您当前的url重定向/请求。如果你在,那么你就会去
因此,在您的示例中,您应该使用@ case 55中提到的/clinical/bbr-category-configuration
https://stackoverflow.com/questions/68013484
复制相似问题