I have a page with a button having ajax function. After the button is clicked, I would like the page to return to a new page with the variable needed to pass into the page. the variable and everything works fine but the page wouldn't go into a new page. It wouldn't even show in the same page only in console.
What should I do to make the view / direct / redirect to show up in a new tab / window?
EDIT the whole code is quite long so let me try cutting them down.
in my controller where I have a function and after function runs it easily returns this
return View::make('date', array('longContents' => $longStringContainAllContents));
in my original parent window I have a button and simple code like this which uses ajax to go into the controller with the correct routes
$.ajax({
method: "post",
url: "/report",
success: function(data){
}
});
in my date.blade.php I just simply have this.
<div class='text-block-single'>{{ $longContents }}</div>
then when I click the button, the page doesn't reload. and in console I can see the ajax is running properly and when I see the responds in console which is good and in the console where I can see the HTML which is good too.
You can't accomplish this with ajax because it's asynchronous call and ajax calls returns ajax responses. So for this staff and without seeing any code , i recommend to do this in a normal request and run redirection from your controller or router. And if you want to open a new browser tab you must do it with JavaScript without involving any ajax and send the data thought in a normal get request to your controller or routes,