Latest

Thursday, July 6, 2017

Laravel Blades - Assign JS variable to PHP variable

Asked by: Przemek G.


Is it possible to assign javascript variable to php variable?

Defined: {{ $var }} and @{{ jsVar }}

I'd like to something like this (this example not working): {{ $var = jsVar }}.

This is needed to pass the parameter to e.g. generate named routes. I can't do something like that route('user', ['id' => jsVar])



Source

No comments:

Post a Comment

Adbox