imacrayon / alpine-ajax

An Alpine.js plugin for building server-powered frontends.
https://alpine-ajax.js.org
MIT License
642 stars 13 forks source link

on href click, change url location #1

Closed 2peter3 closed 1 year ago

2peter3 commented 2 years ago

Hey, is it possible to change the url location on click?

Thanks

imacrayon commented 2 years ago

Sure you can do that without using this plugin:

<a x-data="{ url: '/the/original/link' }" x-ajax="content" :href="url" @click="url = '/a/different/link'">Link</a>

<div id="content"></div>