This article mainly introduces the relevant information about the detailed explanation of the GET request example of the WeChat applet. I hope this article can help everyone understand how to use the get request. Friends in need can refer to it
Detailed explanation of examples of GET requests in WeChat mini programs
People who learn front-end should use ajax get request data, so how to implement get requests in WeChat mini programs? ? Now I will show you a simple get request.
First enter the code:
//index.js //获取应用实例 var app = getApp() Page({ data: { motto: 'Hello World', onLoad: function () { var that = this wx.request({ url: 'http://apis.baidu.com/heweather/weather/free', data: {city:'beijing'}, method: 'GET', // OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT header: {apikey:'a37c01591e47494fe320137dbc0fd423'}, // 设置请求的 header success: function(res){ // success console.log(res) }, fail: function() { // fail }, complete: function() { // complete } }) } })
The result display:
Actually Observing the code, it is not difficult to find that the writing method is similar to ajax, as long as we figure out which parameters need to be configured. The following is the official configuration information.
Note: A WeChat applet can only have 5 network request connections at the same time.
The above is the entire content of this article. I hope it will be helpful to everyone's study. For more related content, please pay attention to the PHP Chinese website!
Related recommendations:
Introduction to the video component in the WeChat mini program
Implementation of the WeChat mini program to simulate cookies
The above is the detailed content of Introduction to GET request of WeChat applet. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 English version
Recommended: Win version, supports code prompts!

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

WebStorm Mac version
Useful JavaScript development tools
