官方 wx.request 代码,Post 没成功过,使用Get 方式成功了。
wx.request({
url: 'test.php', //仅为示例,并非真实的接口地址
data: {
x: '' ,
y: ''
},
header: {
'content-type': 'application/json'
},
success: function(res) {
console.log(res.data)
}
})

PoST 调用代码终于被摸索出来了,我也是醉了

 onLoad: function () {
var that = this;
wx.request({ url: 'https://www.51sdfbavvvy.cn/Mssm/HerNeeo.ashx',
data:{
'TypeID': '0',
'ImageID': 'ZNK',
'Name': ''
},
method: 'POST',
header: {
'content-type': 'application/x-www-form-urlencoded'
},
success:function(res) {
that.setData({
array: res.data.array
})
},
fail:function(res){
console.log('submit fail');
},
complete:function(res){
console.log('submit complete');
} })
},

我的代码:Test.wxml

<view class="section">
<input bindinput="bindKeyInput" placeholder="输入产品编号"/>
<button bindtap="bindButtonTap">搜索</button>
<view class="widgets__item" wx:for-items="{{array}}" wx:for-item="item" >
<view id="{{item.NO}}"class="widgets__info" bindtap="onimageClick" >
<image class="widget__img" src="{{item.Name}}"></image>
<view class="widgettext">
<view class="widget_text1">{{item.NO}}</view>
<view class="widget_text2">{{item.PrdName}}</view>
</view>
</view>
<view class="widget__line"></view>
</view>
</view>

test.js

var app = getApp()
var inputContent = {}//重要代码
Page({
data: {
array: [],
inputContent: {}
},
bindKeyInput: function(e) {
this.setData({
inputValue: e.detail.value
})
inputContent['id'] = e.detail.value
},
//----------------------------------------------------------------------
onLoad: function ()
{
// console.log('form发生了reset事件')
//页面显示时执行这里面的方法 生命周期以后会讲
var that = this;
wx.request({
url: 'http://101.112.36.77:3932/WXTS/NormalPage.aspx?action=',
method: 'GET',
success:function(res) {
that.setData({
array: res.data.array
})
}
})
},
//事件处理函数
onimageClick: function(event) {
wx.navigateTo({
url: '../video/video-av?name='+event.currentTarget.id
})
},
//------------------------------------------------------------
bindChange: function(e) {
inputContent = e.detail.value
},
bindButtonTap: function(e) {
console.log('form发生了reset事件',inputContent['id'])
var that = this;
wx.request({
url: ("http://196.7.25.10:5dd5644/WXTS/NormalPage.aspx?action="+inputContent['id']),//z重要代码
method: 'GET',
success:function(res) {
that.setData({
array: res.data.array
})
}
})
},
//------------------------------------------------------------ })

微信wx.request的更多相关文章

  1. 微信小程序数据请求方法wx.request小测试

    微信小程序数据请求方法 wx.request wxml文件: <view> <textarea value="{{textdata}}"/> </vi ...

  2. 关于微信小程序遇到的wx.request({})问题

    域名请求错误问题 当我们在编写小程序,要发送请求时,wx.request({})时或许会遇到如下的问题: 一:这是因为微信小程序的开发中,域名只能是https方式请求,所以我们必须在小程序微信公众平台 ...

  3. 【微信小程序】调用wx.request接口需要注意的问题

    写在前面 之前写了一篇<微信小程序实现各种特效实例>,上次的小程序的项目我负责大部分前端后台接口的对接,然后学长帮我改了一些问题.总的来说,收获了不少吧! 现在项目已经完成,还是要陆陆续续 ...

  4. 微信小程序的网络设置,及网络请求:wx.request(OBJECT)

    Md2All 一个Markdown在线转换工具 网址:http://md.aclickall.com 微信公众号:颜家大少本文所用排版工具:http://md.aclickall.com 支持通用的M ...

  5. 微信小程序wx.request请求用POST后台得不到传递数据

    微信小程序的wx.request请求,method设为POST并向后台传递数据,但从后台返回的信息来看后台并没有获得传递的数据 wx.request({              url: 'url' ...

  6. 坑:微信小程序wx.request和wx.uploadFile中传参数的区别

    微信小程序中通过组件<form>提交表单的时候,在js中通过e.detail.value得到所提交表单的json格式数据.一般提交表单我们都是通过wx.request请求,提交表单数据,通 ...

  7. 微信小程序 wx.request

    onLoad: function () { var that = this console.log('https://free-api.heweather.com/s6/weather?locatio ...

  8. 微信小程序wx.request接口

    微信小程序wx.request接口 wx.request是小程序客户端与服务器端交互的接口 HTTPS 请求 一个微信小程序,只能同时(同时不能大于5个)有5个网络请求 wx.request(OBJE ...

  9. 微信小程序如何调用API实现数据请求-wx.request()

    前言 微信小程序不存在ajax,那么它是如何实现数据请求功能的呢?在微信中提供了API的调用wx.request(OBJECT),这个是很不错的.下面就讲一下如何请求数据,简单到不行. wx.requ ...

随机推荐

  1. 《设计模式》学习&理解&总结

    教程地址:http://www.runoob.com/design-pattern/design-pattern-tutorial.html 教程书籍:<Android 设计模式解析与实战> ...

  2. Android NDK学习(一):目录结构解析

    我们配置好NDK环境后,基本可以看到其目录结构如下图: 下面我们来分析一下NDK根目录的结构: ndk-build:该Shell脚本是Android NDK构建系统的起始点,一般在项目中仅仅执行这一个 ...

  3. Git使用详细教程(3):git add, git commit详解

    在使用git之前,我们首先要初始化一个git管理的仓库,这里以博客(blog)为例 git init blog 我们进入目录,执行git status查看git状态,可以看到一个新的git管理的项目目 ...

  4. Solr搜索引擎入门知识汇总

    1.技术选型,为什么用solr而不用lucene,或者其他检索工具 lucene:需要开发者自己维护索引文件,在多机环境中备份同步索引文件很是麻烦 Lucene本质上是搜索库,不是独立的应用程序.而S ...

  5. gdb remote 使用

    //设置halt (gdb) set {int}0x400b0000 = 0x1(gdb) load //设置下一个pc指针的值(gdb) set {int}0x400b2000 = 0x80(gdb ...

  6. [原创]K8Cscan插件之存活主机扫描

    [原创]K8 Cscan 大型内网渗透自定义扫描器 https://www.cnblogs.com/k8gege/p/10519321.html Cscan简介:何为自定义扫描器?其实也是插件化,但C ...

  7. vue error:The template root requires exactly one element.

    error:[vue/valid-template-root] The template root requires exactly one element. 原因: 因为vue的模版中只有能一个根节 ...

  8. redis 系列4 数据结构之链表

    一. 概述 链表提供了高效的节点重排能力,以及顺序性的节点访问方式,并且可能通过增删节点来灵活地调整链表的长度.作为一种数据结构,在C语言中并没有内置的这种数据结构.所以Redis构建了自己的链表实现 ...

  9. DWR第一篇之入门示例

    1. 新建maven-web项目,目录结构如下: 2. 在pom.xml里添加dwr所需的依赖 <dependency> <groupId>org.directwebremot ...

  10. solr(五): centos中, 整合 tomcat&solr

    前言 虽然windows下, tomcat和solr整合起来灰常的方便, 但是, 一般像这种东西, 都很少部署在windows中, 更多的是部署到linux中去. 其实, 步骤是一样的, 这里, 我在 ...