Why can't the final console output work?

clipboard.png

Mar.12,2021

id and AccessToken are not both members of data ? Or where did you define it separately?


request asynchronously. Put the console print statement into the success callback to print


javaScript is not executed in the order you want

js is the
var that = this
wx data acquisition function to be executed
console
but the wx data acquisition function is not obtained now, but at some point in the future, js does not know when
and then js will continue to execute console

.

if you want to see console output, use console in success in wx.request
you can check out js micro-tasks, macro tasks and other knowledge points


clipboard.png
this part needs to concatenate your corresponding appid and secret key. In fact, this API should be implemented at the back end, and it is not safe to put it at the front end. Console is the fail entered by your request execution. You should be able to print in fail

.
Menu