84669 Lernen von Personen
152542 Lernen von Personen
20005 Lernen von Personen
5487 Lernen von Personen
7821 Lernen von Personen
359900 Lernen von Personen
3350 Lernen von Personen
180660 Lernen von Personen
48569 Lernen von Personen
18603 Lernen von Personen
40936 Lernen von Personen
1549 Lernen von Personen
1183 Lernen von Personen
32909 Lernen von Personen
根据这篇文章微信小程序使用ajax请求到自己的网站,可以在微信小程序中使用XMLHttpRequest对象实现ajax请求,但实际测试,在page/index/index.js中添加
onLoad() { console.log(XMLHttpRequest); console.log('onLoad'); }
在开发者工具上打印结果却是undefined,是文章错误,还是小程序更新删除了?
以我所知,微信小程序是用MINA开发的。并没有实现浏览器之类的XMLHttpRequest的方法。只有wx.request 这个api
xmlhttp=new XMLHttpRequest(); console.log(xmlhttp);
微信小程序没有window与document对象,只能使用小程序的API,比如:
wx.request({ url: 'test.php', //仅为示例,并非真实的接口地址 data: { x: '' , y: '' }, header: { 'content-type': 'application/json' }, success: function(res) { console.log(res.data) } })
wx.request(OBJECT)
以我所知,微信小程序是用MINA开发的。
并没有实现浏览器之类的XMLHttpRequest的方法。
只有wx.request 这个api
微信小程序没有window与document对象,只能使用小程序的API,比如:
wx.request(OBJECT)