VvvebJs
VvvebJs copied to clipboard
Uncaught SyntaxError: Invalid or unexpected token
I am getting this strange error when fetching HTML from a variable
Vvveb.Builder.init('about:blank', function () {
Vvveb.Gui.init();
Vvveb.Builder.setHtml('{!! $html !!}');
});
The {!! $html !!} is a PHP blade variable, When looking at the inspector it will throw because the next lines are not inside a string? I don't like to do a for each loop to add for each line quotes around it?
Hope there is a better way to do this
Hi
I tried your code and {!! $html !!}
is properly displayed in the page.
If you need {!! $html !!}
to be processed by php before adding it to the page you will need first to send it to the server to be processed by php (blade).
You can do this with ajax and then set the content with something like:
$.get('/process-blade.php', {bladeCode:'{!! $html !!}'}, function (data, textStatus, jqXHR) {
Vvveb.Builder.setHtml(data);
});