課程
/后端開發(fā)
/Java
/SpringBoot構建電商基礎秒殺項目
Uncaught ReferenceError: data is not defined
? ? at <anonymous>:1:1
2019-01-30
源自:SpringBoot構建電商基礎秒殺項目 4-6
正在回答
我又自己給自己解決了這個問題:
我的錯誤的原因,是前面的listitem.html文件中的函數(shù):
function reloadDom(){
for (var i = 0; i <g_itemList.length; i++) {
? ? ? ? ? ? ?var itemVO = g_itemList[i];
? ? ? ? ? ? ? var dom = "<tr data-id='"+itemVO.id+"' id='itemDetail"+itemVO.id+"'><td>"+itemVO.title+"</td><td><img style='width:100px;height auto;' src='"+itemVO.imgUrl+"'/<td><td>"+itemVO.desciption+"</td><td>"+itemVO.price+"</td><td>"+itemVO.stock+"</td><td>"+itemVO.sales+"</td><tr>";
? ? ? ? ? ? ? ? ?$("#container").append($(dom));
? ? ? ? ? ? ? ? ?$("#itemDetail"+itemVO.id).on("click",function(e){
? ? ? ? ? ? ? ? ? ? ?window.location.href="getitem.html?id="+$(this).data("id");
? ? ? ? ? ? ? ? ?});
? ? ? ? ? ? ? }
把這行,錯誤的寫成了:
? ? ? ? ? ? ? ? ? ? ?window.location.href="getitem.html?"+$(this).data("id");
改過來就好了。
同樣是這個錯誤,
data.data
VM101:1 Uncaught ReferenceError: data is not defined
函數(shù)是照著評論區(qū)里的同學提供的copy的,代碼照著老師的敲進去的。
調(diào)試界面,看到報文頭有問題,id沒有傳進去:
Request URL:
http://localhost:8090/item/get?id=
Request Method:
GET
Status Code:
200
Remote Address:
[::1]:8090
Referrer Policy:
no-referrer-when-downgrade
weixin_慕村3424678
把你的那個$("#create").on("click",function(){}? 刪掉就可以
是不是那個函數(shù)沒有寫對啊,評論里面有個老哥推薦的第三個函數(shù)
success獲取errro的回調(diào)里 傳data了嗎? success: function(data){........
舉報
應用SpringBoot快速搭建擁有用戶、商品、交易及秒殺活動的電商秒殺應用。
2 回答關于data.data
4 回答一直提示未知錯誤,不報錯誤信息,debug不了
4 回答order_info建表一直提示錯誤
3 回答登錄后再次下單,還是提示錯誤。調(diào)試沒有錯誤提示,就是下單不成功
2 回答提示500的錯誤,不是跨域問題
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網(wǎng)安備11010802030151號
購課補貼聯(lián)系客服咨詢優(yōu)惠詳情
慕課網(wǎng)APP您的移動學習伙伴
掃描二維碼關注慕課網(wǎng)微信公眾號
2019-06-01
我又自己給自己解決了這個問題:
我的錯誤的原因,是前面的listitem.html文件中的函數(shù):
function reloadDom(){
for (var i = 0; i <g_itemList.length; i++) {
? ? ? ? ? ? ?var itemVO = g_itemList[i];
? ? ? ? ? ? ? var dom = "<tr data-id='"+itemVO.id+"' id='itemDetail"+itemVO.id+"'><td>"+itemVO.title+"</td><td><img style='width:100px;height auto;' src='"+itemVO.imgUrl+"'/<td><td>"+itemVO.desciption+"</td><td>"+itemVO.price+"</td><td>"+itemVO.stock+"</td><td>"+itemVO.sales+"</td><tr>";
? ? ? ? ? ? ? ? ?$("#container").append($(dom));
? ? ? ? ? ? ? ? ?$("#itemDetail"+itemVO.id).on("click",function(e){
? ? ? ? ? ? ? ? ? ? ?window.location.href="getitem.html?id="+$(this).data("id");
? ? ? ? ? ? ? ? ?});
? ? ? ? ? ? ? }
? ? ? ? ? ? ? }
把這行,錯誤的寫成了:
? ? ? ? ? ? ? ? ? ? ?window.location.href="getitem.html?"+$(this).data("id");
改過來就好了。
2019-06-01
同樣是這個錯誤,
data.data
VM101:1 Uncaught ReferenceError: data is not defined
? ? at <anonymous>:1:1
函數(shù)是照著評論區(qū)里的同學提供的copy的,代碼照著老師的敲進去的。
調(diào)試界面,看到報文頭有問題,id沒有傳進去:
Request URL:
http://localhost:8090/item/get?id=
Request Method:
GET
Status Code:
200
Remote Address:
[::1]:8090
Referrer Policy:
no-referrer-when-downgrade
2019-03-09
把你的那個$("#create").on("click",function(){}? 刪掉就可以
2019-02-21
是不是那個函數(shù)沒有寫對啊,評論里面有個老哥推薦的第三個函數(shù)
2019-02-19
success獲取errro的回調(diào)里 傳data了嗎? success: function(data){........