I have the following code in abc.jsp:
<%@page import="soundcap.Soundcap"%>
<%
Soundcap cfl = new Soundcap();
var sfl = cfl.playFile();
%>
I need the value of sfl in an external javascript file (jcode.js). How can I get this value (sfl) from jsp in javascript?
use this...
<%
//get your sfl
%>
<input type="hidden" id="sfl" value="<%=sfl%>">
in your js file use
var sfl=document.getElementById("sfl").value;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With