Hi Lucas,

Could you try

jQuery("#myDiv")

instead of

$('#myDiv')

? It might help.

Thanks,
moon


On Wed, Nov 18, 2015 at 1:30 AM Partridge, Lucas (GE Aviation) <
lucas.partri...@ge.com> wrote:

> Hi,
>
>
>
> I want to use string interpolation in a notebook paragraph so I can pass
> variables from Scala into an %html directive for inline visualization.
> (Indeed there’s an example of this at
> https://www.zeppelinhub.com/viewer/notebooks/aHR0cHM6Ly9yYXcuZ2l0aHVidXNlcmNvbnRlbnQuY29tL0xlZW1vb25zb28vemVwcGVsaW4tZXhhbXBsZXMvbWFzdGVyLzJCMlhLRkNETS9ub3RlLmpzb24
> )
>
>
>
> However I’m getting weird errors when I try to use string interpolation.
> Here’s a very simple example that illustrates the problem.  Try pasting
> this into a Zeppelin paragraph:
>
>
>
> print(s"""%html <div id="myDiv" style="height:400px"></div>
>
> <script>
>
>     $('#myDiv').ready(function() {
>
>         alert('My div is loaded!');
>
>     });
>
> </script>
>
> """)
>
>
>
> When I run the paragraph I get these errors:
>
>
>
> <console>:1: error: invalid string interpolation: `$$', `$'ident or
> `$'BlockExpr expected
>
> print(s"""%html <div id="myDiv" style="height:400px"></div>
>
>                     ^
>
>
>
> <console>:3: error: unclosed character literal
> $('#myDiv').ready(function() {
>
>
>                                                                  ^
>
>
>
> Does anyone know how to fix these errors please?  (I can get rid of the
> second error by replacing the single quotes with double quotes in
> $('#myDiv') but I’m not sure that’s the right thing to do!)
>
>
>
> Many thanks,
>
> Lucas.
>
>
>
> PS Incidentally I’ve noticed in the browser’s Javascript console that the
> paragraph seems to get executed 3 times! Is this expected behaviour?  I’m
> using a standalone installation of the binary zeppelin-0.5.0-incubating.
>
>
>

Reply via email to