我是新來的JavaScript和我想要寫JavaScript腳本的這將作品沒有「本地主機」和端口等JavaScript網址沒有本地主機
這裏是我的代碼的例子:
jQuery.ajax({
type: "GET",
url: "http://localhost:8081/trainer/testToUser",
dataType: "json",
contentType: "application/json; charset=utf-8",
而且我想是這樣的:
jQuery.ajax({
type: "GET",
url: "trainer/testToUser",
dataType: "json",
contentType: "application/json; charset=utf-8",
(這種變異不工作)
瓦例如,工作時沒有任何端口。我讀了關於「window.location」,我應該使用這樣的東西?
當您查看網絡選項卡中的請求時,URL的外觀如何?這可能會告訴你爲什麼它不起作用。 – epascarello