Reputation: 1579
I want to redirect to a URL with an anchor tag so that it will automatically open the targetted tab.
i.e redirect to www.test.com/amazing#so-amazing
In my experience, I can only redirect to the route that has my view option. I don't even know how I can attach the # anchor on the redirect option.
This is my return. Currently, I just set it to reload the page.
return response()->json([
'status' => 'success',
'redirectUrl' => '',
]);
Upvotes: 0
Views: 778
Reputation: 50491
Since you only really need the route URL generated and the hash part of the URL is not dynamic you can just concat some strings together here:
'redirectUrl' => route('your.route', [...]) .'#yourhash';
Would give you your full URL string you were trying to build.
Upvotes: 2