How to parse the result obtained by {code?
Wx. scanQRCode ({needResult: 1, // The default value is 0. the scan result is processed. 1 directly returns the scan result. scanType: ["qrCode", "barCode"], // you can specify whether to scan the QR code or a QR code. by default, both of them have success: function (res) {var result = res. resultStr; // the result returned by scanning the code when the needResult is 1 }});
How to parse the result obtained?
Reply content:
Wx. scanQRCode ({needResult: 1, // The default value is 0. the scan result is processed. 1 directly returns the scan result. scanType: ["qrCode", "barCode"], // you can specify whether to scan the QR code or a QR code. by default, both of them have success: function (res) {var result = res. resultStr; // the result returned by scanning the code when the needResult is 1 }});
How to parse the result obtained?
Var result = res. resultStr; // the result returned by the scan code when the needResult is 1.
Use the debugger, console. log () to print the result value parsing
What does your question mean?
I don't understand. Is the result not the scan result.
You can use the string method to get what you want,
Or pass ajax to the background
Orwindow.location.href = result
All page jumps are allowed.
First, yourres
What is the data type? If yesjson
Format.JSON.parse
Convert to an object to continue the operation.
Success: function (res) {var result = JSON. parse (res); // Convert the json type res to the object if (result. needResult = 1) {alert ('Nice! ');}}