function shovideo(id,vid){ $.ajax({ type: "get", data: "action=getvideoplayauth&vid="+vid, url: "http://wx.yqs.net.cn/ali_auth/auth.php", datatype: "jsonp", jsonp: "callback", success: function(data) { console.log(data); if(data.playauth){ var player = aliplayer({id:id,autoplay: false,width: "100%",height: "100%",vid: vid,playauth: data.playauth}); }else{ console.log(data); } }, error: function() { console.log('request error.'); } }); } vid = "d3eb2bfafe464a299ab59ecbf0582bb8"; //视频vid id="j_prismplayer1";//视频div id shovideo(id,vid);