samedi 21 mai 2016

Laravel blade @include into a Javascript variable?

In a Laravel 5 blade template I have a <script> section.

In this section I need to set a variable to a string that is coming from another blade template.

I tried something like :

<script>
  var a = "@include 'sometext.blade.php' ";
</script>

but this obviously doesn't work.

Also, the included blade can contain both single and double quotes, so these need to be escaped somehow, or the Javascript will not be valid.

Any ideas?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1U5rDD8
via IFTTT

Aucun commentaire:

Enregistrer un commentaire