Laravel view render and javascript?

717 Views Asked by At

I have in my application a lot of generated reports with html tables, now I implemented with vuejs diagrams. But I can't get them rendered because they are in javacript.

$view = view('reports.single.print', ['stats' => $stats]);
$html = $view->render();

In normal browser mode everything is fine, but I need to get rendered html for print mode.

I tried with moving from bottom to <head> <script type="text/javascript" src="{{ asset('assets/js/app.js') }}"></script>

but nothing changes.

My blade looks like:

<body>
@include('header')

HTML TABLE CONTENT

<diagram></diagram>

@include('footer')

<script type="text/javascript" src="{{ asset('assets/js/app.js') }}">
</body>

Can I render somehow also javascript with render() method?

1

There are 1 best solutions below

0
oreopot On

I think you should try adding a closing tag (</script>).

Replace:

<script type="text/javascript" src="{{ asset('assets/js/app.js') }}">

with the following:

<script type="text/javascript" src="{{ asset('assets/js/app.js') }}"></script>