Reputation: 506
I have a Panel with the following :
<xp:panel disableTheme="true">
<div id="mypdfdoc">
</div>
<script>
$(document).ready(function(){
$('#mypdfdoc').PDFDoc( { source : 'pdftest.pdf' } );
});
</script>
</xp:panel>
In this case the source filename is pdftest.pdf. How can I use the value stored in a sessionScope as source filename in this example?
Upvotes: 1
Views: 1041
Reputation: 10485
If you change your script block to an Output Scriptblock, you can use inline SSJS code like this:
<xp:scriptBlock id="scriptBlock1">
<xp:this.value>
<![CDATA[
$(document).ready(function(){
$('#mypdfdoc').PDFDoc(
{ source : '#{javascript:return sessionScope.PDFName}' }
);
});
]]>
</xp:this.value>
</xp:scriptBlock>
EDIT:
This can be used for any CSJS, not only jQuery.
Upvotes: 8