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

unlikenesses's avatar

Get query string from card

I want to create a button which will download a CSV of the current resource from its index page. To do this I have created a card, with a button in it, and added this card to the resource:

<template>
    <card class="flex flex-col items-center justify-center">
        <h1 class="text-center text-3xl text-80 font-light">Export</h1>
        <button class="btn btn-default btn-primary mt-8" @click="download()">Download as CSV</button>
    </card>
</template>

<script>
export default {
    props: [
        'card'
    ],
    data: () => ({
        endpoint: '/nova-vendor/export/',
    }),
    methods: {
        download() {
            let url = this.endpoint + 'export'
            Nova.request().get(url).then(response => {
                console.log(response)
            })
        }
    }
}
</script>

The problem is that the index can also sometimes have filters applied to it. To grab them I want to be able to get the query string in my Card JavaScript. Is there a Nova-friendly way to do this?

0 likes
2 replies
lostdreamer_nl's avatar

You can simply get them from the window object

console.log(window.location.search);
// or a specific parameter
var urlParams = new URLSearchParams(window.location.search);
var myParam = urlParams.get('myParam');
console.log(myParam );
unlikenesses's avatar

Thanks - I was wondering if there's specifically a Nova-friendly way to get the filters I need.

Please or to participate in this conversation.