Yardım Lütfen - PHP Select resim çekme |
4 Mesajlar | 675 Okunma |
document.getElementById('select').addEventListener('change', function(){
var xhr = new XMLHttpRequest();
xhr.open('POST', 'xhr-file.php', true);
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
xhr.function() {
// success
if (this.readyState === XMLHttpRequest.DONE && this.status === 200) {
} // error
else if (this.status >= 400) {
}
}
var selected_option = document.getElementById('select').options[e.selectedIndex].value; // selected value
xhr.send('value=' + selected_option);
});
$(document).on('change', '#select', function () {
var selected_option = $('#select option:selected').val(); // selected value
$.ajax({
url: 'ajax-file.php',
type: 'POST',
data: {value: selected_option},
dataType: 'json',
success: function (response) {
},
error: function (jqXHR, textStatus, errorThrown) {
printError(jqXHR, textStatus, errorThrown);
}
});
});