Skip to content

How to pass input value by name to api url of dropdown? #2100

Discussion options

You must be logged in to vote

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.

.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

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@vihatsoft
Comment options

Answer selected by vihatsoft
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment