Salve a tutti,
come passo il valore di un campo ENUM nel codice javascript?
i valori sono Yes e No
form
Codice PHP:
<!--5-->
<div class="row">
<div class="col-md-3">
<label>In collection</label>
</div>
<div class="col-md-9">
<select name="incollection_modal" id="incollection_modal" class="form-control-sm" required>
<option value="incollection_modal">Yes</option>
<option value="incollection_modal">No</option>
</select>
</div>
</div>
script
Codice HTML:
<script>
$(document).ready(function() {
$.ajax({
url: "View_ajax.php",
type: "POST",
cache: false,
success: function(dataResult){
$('#table').html(dataResult);
}
});
$(function () {
$('#update_country').on('show.bs.modal', function (event) {
var button = $(event.relatedTarget); /*Button that triggered the modal*/
var id = button.data('id');
var name = button.data('name');
var email = button.data('email');
var phone = button.data('phone');
var city = button.data('city');
var incollection = button.data('incollection');
var modal = $(this);
modal.find('#name_modal').val(name);
modal.find('#email_modal').val(email);
modal.find('#phone_modal').val(phone);
modal.find('#city_modal').val(city);
modal.find('#id_modal').val(id);
modal.find('#incollection_modal').val(incollection);
});
});
$(document).on("click", "#update_data", function() {
$.ajax({
url: "update_ajax.php",
type: "POST",
cache: false,
data:{
id: $('#id_modal').val(),
name: $('#name_modal').val(),
email: $('#email_modal').val(),
phone: $('#phone_modal').val(),
city: $('#city_modal').val(),
incollection: $('#incollection').val(),
},
success: function(dataResult){
var dataResult = JSON.parse(dataResult);
if(dataResult.statusCode==200){
$('#update_country').modal().hide();
alert('Data updated successfully !');
location.reload();
}
}
});
});
});
</script>