Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

hjortur17's avatar

A tag have href and click event.

Hi, is it possible to have vue do both? Because I want to make vue create a booking when the tag is clicked (this is done with a function) and also redirect the customer to a payment gateway?

Here is the a tag: <a :href="korta_link" @click="checkPaymentForm(), addBookingToDatabase(), kortaSubmitForm()" class="bg-orange-500 text-white font-bold text-center px-12 py-2 rounded-full">Borga

0 likes
4 replies
Tray2's avatar

Sure but you need to have a method doing it.

You @click runs one function name then inside that function you run every step.

@click="doStuff()"

function doStuff() {
    checkPaymentForm();
        addBookingToDatabase();
        kortaSubmitForm();
}
hjortur17's avatar

Now I get this:

Access to XMLHttpRequest at 'https://netgreidslur.korta.is/?amount=5500&currency=ISK&merchant=8190444&terminal=52176&description=Park%20and%20fly&lang=is&checkvaluemd5=1e1a5f681a57c9d383bbbbf686934467&downloadurl=https://parkandfly.is/api/database/booking/update&refermethod=POST&refertarget=_top&reference=null&startnewpayment=y' from origin 'http://localhost:3000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.

But I have Cors.php like this:

public function handle($request, Closure $next)
    {
        return $next($request)
            ->header('Access-Control-Allow-Credentials', 'true')
            ->header('Access-Control-Allow-Origin', '*')
            ->header('Access-Control-Allow-Headers', 'X-Requested-With');
    }
cometads's avatar

Do you own and control "netgreidslur.korta.is"?

If so, then try laravel-cors instead of custom middleware.

If not, you'll want to make the request to your backend which itself makes the call to netgreidslur.korta.is to avoid CORS issues.

Please or to participate in this conversation.