Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/371.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在javascript中重定向到准确的url_Javascript - Fatal编程技术网

如何在javascript中重定向到准确的url

如何在javascript中重定向到准确的url,javascript,Javascript,当我试图像这样访问url时 $.get(“getdetailofselectedcustmor/”,函数(){ }) 在我的js代码中,我被重定向到“current url+getdetailofselectedcustmor”,但我所寻找的只是被重定向到“localhost:8000/getdetailofselectedcustmor/”,我该怎么做呢?这不是Django的问题,而是js请求的问题 确保始终将/放在要请求的任何资源路径之前 像这样 $.get("/getdetailofsel

当我试图像这样访问url时

$.get(“getdetailofselectedcustmor/”,函数(){

})


在我的js代码中,我被重定向到“current url+getdetailofselectedcustmor”,但我所寻找的只是被重定向到“localhost:8000/getdetailofselectedcustmor/”,我该怎么做呢?

这不是Django的问题,而是js请求的问题

确保始终将
/
放在要请求的任何资源路径之前

像这样

$.get("/getdetailofselectedcustmor/", function(...){...})

在传递的路径的开头添加
/