<script type="text/javascript" src="http://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script> <script type="text/javascript"> var imgUrl = 'http://cdn-app-qn.colorv.cn/img/test/f511d8de5f770e35b1e6ba681115e0476b0a9e807d7c3-Xle0kk_fw658_36cfdf43fbe1c09187046ba228acb0c9.jpg'; // A picture displayed after sharing var lineLink = 'http://xxxxx.com/specified page link'; // You can write the page address to jump to after clicking the share var lineLin = location.href; var descContent = "This is the description of the content I want to share"; // Description after sharing var shareTitle = 'Color video sharing, video sharing'; // Title after sharing $.ajax({ url: 'http://xxxxx.com/api/getTicketList', //Get the interface list of js in the background type: 'get', dataType: 'json', success: function(resp) { wx.config({ debug: true, // Turn on the debug mode, the return values of all the apis called will be alerted on the client side, if you want to view the incoming parameters, you can open it on the pc side, and the parameter information will be printed out through the log, only on the pc side will print. appId: resp.data.appId, // Required, the unique ID of the official account timestamp: resp.data.timestamp, // required, the timestamp of the generated signature nonceStr: resp.data.nonceStr, // required, generate a random string for signature signature: resp.data.signature, // required, signature, see appendix 1 jsApiList: resp.data.jsApiList // Required, a list of JS interfaces to be used, see Appendix 2 for a list of all JS interfaces }); } }); function shareFriend() { // The callback function that is executed after the user confirms the sharing }, }) } function shareTimeline() { wx.onMenuShareTimeline({ title: shareTitle, // share title link: lineLink, // Share link, the link domain name or path must be consistent with the public account JS security domain name corresponding to the current page imgUrl: imgUrl, // share icon success: function() { // The callback function that is executed after the user confirms the sharing }, }) } function shareQQ() { wx.onMenuShareQQ({ title: shareTitle, // share title desc: descContent, // share description link: lineLink, // Share link, the link domain name or path must be consistent with the public account JS security domain name corresponding to the current page imgUrl: imgUrl, // share icon success: function() { // The callback function that is executed after the user confirms the sharing }, }); } function shareQZone() { wx.onMenuShareQZone({ title: shareTitle, // share title desc: descContent, // share description link: lineLink, // Share link, the link domain name or path must be consistent with the public account JS security domain name corresponding to the current page imgUrl: imgUrl, // share icon success: function() { // The callback function that is executed after the user confirms the sharing }, }); } function shareWeibo() { wx.onMenuShareWeibo({ title: shareTitle, // share title desc: descContent, // share description link: lineLink, // Share link, the link domain name or path must be consistent with the public account JS security domain name corresponding to the current page imgUrl: imgUrl, // share icon success: function() { // The callback function that is executed after the user confirms the sharing }, }); } wx.ready(function(){ // send to friend shareFriend(); // Share to Moments shareTimeline(); // share to qq shareQQ (); // Share to QZone shareQZone (); // share to weibo shareWeibo(); }); </script>