Is it possible to send an ajax request through vue-resource when a specific item is selected from a "Select" in vuejs?
Check out the demo here: https://jsfiddle.net/xoyhdaxy/
<div class="container" id="app">
<select v-model="selected">
<option v-for="option in options" v-bind:value="option.value">
{{ option.text }}
</option>
</select>
<span>Selected: {{ selected }}</span>
</div>
new Vue({
el: '#app',
data: {
selected: '1',
options: [
{ text: 'One', value: '1' },
{ text: 'Two', value: '2' },
{ text: 'Three', value: '3' }
]
}
});
For instance:
If we want to trigger an ajax request with the value "2" using vue-resource when the item "two" is selected, how would we go about writing the code for this scenario?