簡體   English   中英

嘗試從 PC 瀏覽器訪問 Raspberry Pi web 頁面時出現錯誤 403

[英]Error 403 when trying to access Raspberry Pi web page from PC browser

我正在為學校做一個項目,我正在嘗試從我的樹莓派上的 web 頁面讀取數據,並將其顯示在我的 PC web 頁面上的頁面上。 我正在使用 ajax,但是當我嘗試訪問 IP 192.168.1.8 上的 RPi 上的 web 頁面時,它給了我一個錯誤“知道該怎么做”40

我進入頁面的代碼:

function AddShoots() {
  $.ajax({
    method: "POST",
    url: "http://192.168.1.8",
    success: function (html) {
      alert(html);
    },
  });
}

錯誤圖片:如果有幫助,對不起我來自斯洛文尼亞的語言,所以是斯洛文尼亞語

解決它!

  1. 我在我的 PC 和 RPi 上調整了 IP 地址。 I have them connected through a straight-through ethernet cable, so I set a static IP on my PC for an ethernet connection and I set static IP on my RPi for eth0.
  2. 我在 PC 的網絡設置中啟用了跨網絡共享
  3. 我啟用了標題並在 apache 上添加了 CORS header (如何在此處啟用它們

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM