Getting Date from http header response

前端 未结 4 622
既然无缘
既然无缘 2021-01-12 09:17

Okay so I can access the HTTP ajax response header using

xhr.getAllResponseHeaders();

but it doesn\'t seem to get the Date with it, though

4条回答
  •  死守一世寂寞
    2021-01-12 09:49

    in your success method:

     success: function (data,status, xhr) {
    
        console.log(xhr.getResponseHeader('Date'));
    
    
    },
    

    If response is a success

    res=xhr.getResponseHeader('Date');
    

    if response fails

    res=data.getResponseHeader('Date');
    

提交回复
热议问题