[英]Can I invoke a servlet URLwithout using AJAX
Can I invoke a URL, directly from javascript without using AJAX,on click of a play button, i am calling the playAlbumFromMediaUrl(). 我可以直接从javascript调用URL,而无需使用AJAX,只要单击播放按钮,就可以调用playAlbumFromMediaUrl()。
function playAlbumFromMediaUrl() {
var trackMasterList = document.audioDetails.trackMasterIdList.value;
var stringUrl = trackMasterList.split('::');
for (var i = 0; i < stringUrl.length - 1; i++) {
playlist[i] = {
file: stringUrl[i],
provider: "/teams/web/jwplayer/AkamaiAdvancedJWStreamProvider.swf"
}
}
setTimeout(function () {
jwplayerSetupForPlayAlbum();
}, 1000);
}
function jwplayerSetupForPlayAlbum() {
jwplayer('html5AudioPlayer').setup({
playlist: [{
file: "http://localhost:8080/servlet/MediaLibraryAccessServlet?trackMasterId=898035&isProtocol=rtmpe&assetFormat=MP448Full",
provider: "/teams/web/jwplayer/AkamaiAdvancedJWStreamProvider.swf"
}],
width: 550,
height: 30
}).play();
}
Once the url is invoked,it calls the MediaLibraryAccess servlet class that returns a mp4 url, that can be played by the jwplayer. 调用该URL后,它将调用MediaLibraryAccess servlet类,该类返回一个mp4 URL,该URL可以由jwplayer播放。
I need to invoke the servlet url,without using AJAX. 我需要在不使用AJAX的情况下调用servlet网址。 For simplicity, i am not looping the playlist,instead i hard coded the servlet URL call in the jwplayer file attribute. 为简单起见,我没有循环播放列表,而是在jwplayer文件属性中硬编码了servlet URL调用。
Can anyone help with this. 有人能帮忙吗。
As far as i know there are 4 basic ways to call a URL. 据我所知,有4种调用URL的基本方法。
Eliminating option 2-3 you are left with only option 1 witch I doubt that it will fill your needs. 消除选项2-3,您只剩下选项1的女巫,我怀疑这是否会满足您的需求。 I think you should spend some times and make it work using options 2 or 3 我认为您应该花一些时间,并使用选项2或3使它工作
UPDATE: 更新:
To use option 1 or 4 using javascript see Window.location.href and Window.open () methods in JavaScript 要使用javascript使用选项1或4,请参见JavaScript中的Window.location.href和Window.open()方法
In short for Option 1 you can use: 选项1的简称,您可以使用:
window.location.href = 'http://www.google.com'; //Will take you to Google using GET.
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.