python flashkとWeChatウィジェットのインタラクティブを記録します。


一、小さいプログラムはflashkにパラメータを伝えます。
1.ウィジェットは要求データをJSON形式に変換します。
   wx.request({
      url: 'http://127.0.0.1:8080/query_user',
      data: {
        goodsname:JSON.stringify(inputTyping)  //       JSON

      },
      method: "POST",
      header: {
        'content-type': 'application/x-www-form-urlencoded'
      },
      success: function (res) {
        console.log(res.data);
             
      }
    });
2.flashk受信

p_goodsname = request.values.get("goodsname") print(json.loads(p_goodsname)) p_goodsname = json.loads(p_goodsname) 、flask ( )1.flask

return json.dumps(aftersort, ensure_ascii=False)  #aftersort        
2.ウィジェット
   wx.request({
      url: 'http://127.0.0.1:8080/query_user',
      data: {
        goodsname:JSON.stringify(inputTyping)

      },
      method: "POST",
      header: {
        'content-type': 'application/x-www-form-urlencoded'
      },
      success: function (res) {
        console.log(res.data);  //         
            
      }
    });