Micro-channel sharing

 

var Link = the location.href 
$ .ajax ({ 
  URL: 'your_URL is', // background give you interface 
  type: 'the GET' , 
  Data: {URL: Link}, 
  the async: to true , 
  dataType: 'JSON' , 
  Success : function (the Data) { 
    wx.config ({ 
      debug: false , // turn on debug mode, all api return value in the client alert call out 
      appId: data.configMap.appId, // required, number of public uniquely identifies the 
      timestamp: data.configMap.timestamp, // required to generate a signature timestamp 
      nonceStr: data.configMap.nonceStr, // required to generate a random string signature
      Signature: data.configMap.signature, // required, signature, see Appendix. 1 
      jsApiList: [ 'onMenuShareTimeline', 'onMenuShareAppMessage'] // required, need to use the list of interfaces JS, JS all interfaces listing in Appendix 2 
    }) 
    wx.ready ( function (RES) { 
      wx.onMenuShareAppMessage ({ 
        title: document.title, 
        desc: document.title, 
        Link: Link, 
        for imgUrl: imgUrl, 
        Trigger: function (RES) {}, 
        Success: function (RES) { }, 
        Cancel: function (RES) {}, 
        Fail: function (RES) {}  
      })
      wx.onMenuShareTimeline ({
        title: document.title,
        link: link,
        imgUrl: Imgurl,
        trigger: function(res) {},
        success: function(res) {},
        cancel: function(res) {},
        fail: function(res) {}
      })
    })
    wx.error(function(res) {
      alert(res)
    })
  },
  error: function(error) {
    alert(error)
  }
})

 

Guess you like

Origin www.cnblogs.com/fenle/p/12617062.html