根据这篇文章微信小程序使用ajax请求到自己的网站,可以在微信小程序中使用XMLHttpRequest对象实现ajax请求,但实际测试,在page/index/index.js中添加
onLoad() {
console.log(XMLHttpRequest);
console.log('onLoad');
}
在开发者工具上打印结果却是undefined,是文章错误,还是小程序更新删除了?
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
以我所知,微信小程序是用MINA开发的。
并没有实现浏览器之类的XMLHttpRequest的方法。
只有wx.request 这个api
微信小程序没有window与document对象,只能使用小程序的API,比如:
wx.request(OBJECT)