1
$('#status').parent().append('<a href="' + data.output.url + '" id="link">Download file</a>');

How to print "data.output.url" variable in Laravel View.

Jerodev
  • 32,252
  • 11
  • 87
  • 108
  • And How to sotre file directly from URL to specific location ? –  Nov 14 '14 at 11:31
  • You can edit your original post and add your 2nd question to it. – Nabil Kadimi Nov 14 '14 at 11:36
  • 1
    possible duplicate of [Print JavaScript variable value inside a php tag using blade template in Laravel](http://stackoverflow.com/questions/20177054/print-javascript-variable-value-inside-a-php-tag-using-blade-template-in-laravel) – Nabil Kadimi Nov 14 '14 at 11:37
  • This is probably duplicate question. I sorted out very similar problem here: http://stackoverflow.com/a/28629676/2776843 – 99problems Feb 20 '15 at 13:09

1 Answers1

0

You can use the curly braces like this in the blade template:

$('#status').parent().append('<a href="' + {{ $dataOutputUrl }} + '" id="link">Download file</a>');

...Where $dataOutputUrl a php variable passed to the template. The template gets parsed and the variable will get output into the javascript.

omarjebari
  • 4,861
  • 3
  • 34
  • 32