作者wahahahaaa (hah)
看板Ajax
標題[問題] 使用express建立專案但無法運行
時間Mon Mar 16 15:31:59 2020
請教版上高手 近期跟著'一次搞懂JavaScript 全端技術.."這本書自學
用express建立專案 安裝npm
現在照著書上的程式碼和路徑跟著寫一次 但卻無法運行
找好久找不到原因
資料夾長相:
https://imgur.com/TzQRCdE
Js:
https://imgur.com/nBIlemg
https://imgur.com/TYPBWYl
更正為下:
https://imgur.com/T3Szgtx
https://imgur.com/Q9N2Ps1
https://imgur.com/TGdsxWe
Html:
https://imgur.com/5xmDwFD
https://imgur.com/0BFb0i0
CSS:
https://imgur.com/iMP5Ir2
api.js:
https://imgur.com/LuOoV6R
app.js:
https://imgur.com/GRsx7YC
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 118.161.79.20 (臺灣)
※ 文章網址: https://webptt.com/m.aspx?n=bbs/Ajax/M.1584343921.A.EAA.html
※ 編輯: wahahahaaa (118.161.79.20 臺灣), 03/16/2020 15:33:17
1F:推 icydream: 不能正常執行的錯誤訊息是? 03/16 16:42
想要新增一筆待辦清單 輸入完內容 按確認 網頁沒有反應
https://imgur.com/cuFHjPG
https://imgur.com/jWTWfUl
※ 編輯: wahahahaaa (118.161.79.20 臺灣), 03/16/2020 17:00:23
2F:→ tino1991: js Line:10, 21 的newList() 在哪? 03/16 17:17
3F:→ tino1991: 瀏覽器按F12應該有console可以看 03/16 17:20
newList()漏寫, 程式碼已修正 還有補寫一editList(id)方法
試跑一次後看console 如下:
https://imgur.com/BqsSQ1h
https://imgur.com/ZAvGd4n
※ 編輯: wahahahaaa (118.161.79.20 臺灣), 03/16/2020 18:04:50
4F:→ tino1991: $是jQuery, 你要先載入再拿來用 html Line:5, 6順序交換 03/16 18:56
5F:→ tino1991: Js Line:10 ajax的callback fn只有res, data是多餘的? 03/16 19:01
6F:→ brianwu1201: 貼 github 上來吧 03/16 20:21
7F:→ wahahahaaa: Line5&6交換後可以新增清單了!!!感謝t大!! 03/16 20:47
8F:→ wahahahaaa: (res, data) 改成 --> (res.data) 03/16 20:50
9F:→ wahahahaaa: 可以運行了~~^^ 03/16 20:50