How to pass input value by name to api url of dropdown? #2100
Answered
by
lubber-de
vihatsoft
asked this question in
Modules (Modal, Dropdown, Popup, Calendar, Toast, ...)
-
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.
thank you |
Beta Was this translation helpful? Give feedback.
Answered by
lubber-de
Sep 13, 2021
Replies: 1 comment 1 reply
-
Your approach adds the input field value only once when the dropdown is initiated. .dropdown({
apiSettings: {
url: '/get_category.php?type={type}',
beforeSend: function(settings) {
settings.urlData = {
type: $('input[name="filter_id"]').val()
};
return settings;
},
cache: false
}
}); https://fomantic-ui.com/behaviors/api.html#4-settings-returned-from-beforesend |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
vihatsoft
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Your approach adds the input field value only once when the dropdown is initiated.
Instead use a placeholder for the type parameter and change that before the api is sending to the backend.
https://fomantic-ui.com/behaviors/api.html#4-settings-returned-from-beforesend