JSFiddle - React, Tailwind, and code Playground
by mkdizajn
HTML
<select class="select" id="myselect">
<option value="" disabled selected hidden>Producent</option>
<option value="apple">Apple</option>
<option value="sony">Sony</option>
<option value="ikea">IKEA</option>
</select>
JavaScript
$( '#myselect' ).on( 'change', function(e){
e.preventDefault();
$.ajax({
url: 'path/to/service.php',
data: $( this ).val(),
success: function(data){
// write that data somewhere
// or do some other logic on page..
// this will only console.log it
console.log ( data )
},
});
} );