I'm trying to write a simple redirection using javascript and blade engine, and this is an example of what i want to do:
javascript code:
<p>Click the button to go to the home page</p>
<button onclick="myFunction()">Click me</button>
<p id="demo"></p>
<script>
function myFunction()
{
var x;
var r=confirm("Are you sure you want to leave this page ?");
if (r==true)
{
//Redirect to home
}
else
{
//stay here
}
document.getElementById("demo").innerHTML=x;
}
</script>
when i use return Redirect::route('home')
it does not work, what is the right syntax to do that, and sorry for my bad english.