fetch發請求

 fetch('/galaxy/query', {

                  method:'POST',
                  headers:{
                     'Content-Type': 'application/json'
                  },
                  body:JSON.stringify({
                    city:formitem.city,
                    date:formitem.date,
                    condition:formitem.station,
                  })
                }).then(data => data.json())
                .then(data => {
                  console.log(data);

                })

fetch('/galaxy/query?topicURL=${this.topicURL}', {

                  method:'GET',
                  headers:{
                     'Content-Type': 'application/json'
                  },
                  body:JSON.stringify({
                    city:formitem.city,
                    date:formitem.date,
                    condition:formitem.station,
                  })
                }).then(data => data.json())
                .then(data => {
                  console.log(data);

                })

http://www.jianshu.com/p/75a18e565f33

http://bubkoo.com/2015/05/08/introduction-to-fetch/

https://jakearchibald.com/2015/thats-so-fetch/


發佈了97 篇原創文章 · 獲贊 16 · 訪問量 8萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章