is there any ways that JavaScript can get the variable from compact controller Laravel-5.
Example: I have the code below:
$langs = Language::all()
One working example for me.
Controller:
public function tableView() { $sites = Site::all(); return view('main.table', compact('sites')); }
View:
To prevent malicious / unintended behaviour, you can use JSON_HEX_TAG as suggested by Jon in the comment that links to this SO answer
JSON_HEX_TAG