js fetch

111

  fetch(url, 
  { method: 'post', body: data })
                    .then(response => { if (!response.ok) { throw new Error('Network response was not OK'); } if (response.redirected) { alert('登录超时,请重新登录') } else { return response.text() } })
                    .then(response => { alert(response) })
                    .catch(error => { });

 

posted on 2025-01-25 13:54  lucika.zh  阅读(7)  评论(0)    收藏  举报

导航