Ad

Hitting 2 URLS Using An Anchor Tag In Laravel

- 1 answer

I have got an ancor link tag on the DOM and would like to hit 2 URLS once it is clicked, the endpoints are route('b2c.receipt') and route('b2c.flushData')

<a target="_blank" rel="nofollow noreferrer" href="{{ route('b2c.receipt') }}"> Download Receipt</a>
Ad

Answer

You won't really be able to do this with a raw anchor tag.

Given the name of your second route, flushData, it may be that you can incorporate the "flush data" logic into the first route's controller function.

If not, you're going to need to use JavaScript to fire off two AJAX requests.

Ad
source: stackoverflow.com
Ad