在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 問(wèn)答/HTML/ react鏈接node接口獲取不要數(shù)據(jù)庫(kù)的數(shù)據(jù)?

react鏈接node接口獲取不要數(shù)據(jù)庫(kù)的數(shù)據(jù)?

在node中設(shè)置一個(gè)接口,用react調(diào)用這個(gè)接口,一直顯示的是狀態(tài)碼是304
react:

componentWillReceiveProps(nextProps){
    let that=this;
    let tab=nextProps.tab||'attention';
    let sort=nextProps.sort||'like'
    $.ajax({
        type:'get',
        url:'/list/show',
        success:function(data){
            console.log(data)
        }
    })
}

node:

console.log(2)
app.get('/list/show',(req,res)=>{
    console.log(1)
    res.send({name:'12'})
})

node執(zhí)行的時(shí)候控制臺(tái)的打印是:

clipboard.png

頁(yè)面在瀏覽器中的顯示是:

clipboard.png

clipboard.png

一開(kāi)始以為是給node接口傳參數(shù)傳的不對(duì),現(xiàn)在講接口簡(jiǎn)化到最簡(jiǎn)單的還是這種情況,請(qǐng)問(wèn)這是怎么造成的,還有就是為什么app.get的進(jìn)不到函數(shù)中console不出來(lái)1呢?

回答
編輯回答
舊城人
ajax({
  ...
  cache: false
})
2018年1月16日 03:23