Semantic-UI icon indicating copy to clipboard operation
Semantic-UI copied to clipboard

How to pass data to api url using dropdown?

Open viratsoft opened this issue 4 years ago • 1 comments

how can i send input value to dropdown api url from another input value by name?

when i try like bellow but not send current value of filter_id input to api url of dropdown.

.dropdown({
            apiSettings: {
                url: '/get_category.php?type='+ $('input[name="filter_id"]').val(),
                cache: false
            },

thank you

viratsoft avatar Sep 12 '21 08:09 viratsoft

Have you tried modifying the settings object with the beforeSend callback? Something like this should work:

apiSettings: {
    beforeSend: settings => {
        settings.url = `/get_category.php?type=${$('input[name="filter_id"]').val()}`;
        return settings;
    }
}

GammaGames avatar Sep 21 '21 15:09 GammaGames