Semantic-Org / Semantic-UI

Semantic is a UI component framework based around useful principles from natural language.
http://www.semantic-ui.com
MIT License
51.1k stars 4.95k forks source link

How to pass data to api url using dropdown? #7064

Open vihatsoft opened 3 years ago

vihatsoft commented 3 years ago

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

GammaGames commented 3 years ago

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;
    }
}