程序新新新人 2020-04-06 12:15 采纳率: 0%
浏览 325
已采纳

微信小程序通过 C#的接口传值,没有反应,也不报错

这个我本地写的一个接口

这个是我的调用代码

我的想法是通过js直接调用C#的接口,然后传值,把接口当一个中转站,把值传过去。

我现在修改了写法,这样提示错误了,是什么原因呢?

 wx.request({
        url: 'http://localhost:200/WebService.asmx?op=InpUser',
        method: 'POST',
        header: {
          'content-type': 'application/x-www-form-urlencoded'
        },
        data: {
          Name: this.data.MyName,
          Phone: this.data.MyPhone,
          LFY: this.data.MyLFY,
          Email: this.data.MyEmail
        },
        success: function (res) {
          if (res.data.err == 0) {
            wx.showToast({
              title: '保存成功',
              success: res => {
                setTimeout(function () {
                  wx.switchTab({
                    url: '/pages/TextInput/TextInput',
                  })
                }, 2000);
              }
            })
          } else {
            that.setData({
              msg: res.data.errtxt
            })
          }
        }

错误提示

POST http://localhost:200/WebService.asmx?op=InpUser 500 (Internal Server Error)
v @ VM1687 asdebug.js:1
createRequestTask @ VM1687 asdebug.js:1
n @ VM1687 asdebug.js:1
invoke @ VM1689 WAService.js:2
l @ VM1689 WAService.js:2
(anonymous) @ VM1689 WAService.js:2
y @ VM1689 WAService.js:2
(anonymous) @ VM1689 WAService.js:2
rc @ VM1689 WAService.js:2
a @ VM1689 WAService.js:2
(anonymous) @ VM1689 WAService.js:2
n @ VM1689 WAService.js:2
(anonymous) @ VM1689 WAService.js:2
p.<computed> @ VM1689 WAService.js:2
(anonymous) @ VM1689 WAService.js:2
(anonymous) @ VM1689 WAService.js:2
(anonymous) @ VM1689 WAService.js:2
(anonymous) @ VM1689 WAService.js:2
loginBtnClick @ test.js? [sm]:36
r.safeCallback @ VM1689 WAService.js:2
(anonymous) @ VM1689 WAService.js:2
c @ VM1689 WAService.js:2
(anonymous) @ VM1689 WAService.js:2
r @ VM1689 WAService.js:2
(anonymous) @ VM1689 WAService.js:2
(anonymous) @ VM1689 WAService.js:2
n @ VM1687 asdebug.js:1
(anonymous) @ VM1687 asdebug.js:1
(anonymous) @ VM1687 asdebug.js:1
_ws.onmessage @ VM1687 asdebug.js:1
VM1683:1 thirdScriptError
that is not defined;at api request success callback function
ReferenceError: that is not defined
    at success (http://127.0.0.1:25869/appservice/pages/test/test.js:62:13)
    at Object.o.<computed> (http://127.0.0.1:25869/appservice/__dev__/WAService.js:2:1431866)
    at http://127.0.0.1:25869/appservice/__dev__/WAService.js:2:589634
    at Module.c (http://127.0.0.1:25869/appservice/__dev__/WAService.js:2:1591990)
    at Function.<anonymous> (http://127.0.0.1:25869/appservice/__dev__/WAService.js:2:589609)
    at http://127.0.0.1:25869/appservice/__dev__/WAService.js:2:127365
    at E (http://127.0.0.1:25869/appservice/__dev__/WAService.js:2:541004)
    at i.<anonymous> (http://127.0.0.1:25869/appservice/__dev__/WAService.js:2:920298)
    at i.emit (http://127.0.0.1:25869/appservice/__dev__/WAService.js:2:599114)
    at ic (http://127.0.0.1:25869/appservice/__dev__/WAService.js:2:921160)
  • 写回答

1条回答 默认 最新

  • threenewbee 2020-04-06 13:44
    关注

    你的webservice是基于soap的,而你提交的数据是json,这就好比一个美国人用英文和一个中国人说话,当然没用。

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥50 有偿求qftp工具。能连接,下载文件,发送代码,windows环境,最好qt6 要qt creator写的
  • ¥70 刚刚看到一个人的网站居然是通过cname访问的
  • ¥15 Attributeerror:super object has no attribute '__sklearn_tags__'_'
  • ¥15 逆置单链表输出不完整
  • ¥15 宇视vms-B200-A16@R启动不了,如下图所示,在软件工具搜不到,如何解决?(操作系统-linux)
  • ¥500 寻找一名电子工程师完成pcb主板设计(拒绝AI生成式答案)
  • ¥15 关于#mysql#的问题:UNION ALL(相关搜索:sql语句)
  • ¥15 matlab二位可视化能否针对不同数值范围分开分级?
  • ¥15 已经创建了模拟器但是不能用来运行app 怎么办😭自己搞两天了
  • ¥15 关于#极限编程#的问题,请各位专家解答!