微信小程序接受asp.net 返回的json值处理
发布时间:作者:济南小程序开发来源:未知点击:
一:微信小程序接受asp.net 返回的json值处理
wx.request({
url: 'https://l网址er.aspx',
data: {
openId: wx.getStorageSync('openId'),
requestType: "query"
},
success: function (response) {
//
//console.log(response)
//console.log(response.data)
//console.log(response.statusCode)
if (response.statusCode == '200') {
var count = response.data.indexOf("\r\n\r\n<!DOC");
var str = response.data.substring(0, count)
var json = JSON.parse(str)
//保存信息
console.log(str+"长度" + json.length)
} else {
wx.showToast({
title: '信息读取失败,请联系客服!',
icon: 'success',
duration: 1500
})
}
}
});
二:判断是否是手机号
validatemobile: function (mobile) {
if (mobile.length == 0) {
wx.showToast({
title: '请输入手机号!',
icon: 'success',
duration: 1500
})
return false;
}
if (mobile.length != 11) {
wx.showToast({
title: '手机号长度有误!',
icon: 'success',
duration: 1500
})
return false;