Hi, i don't know how to pass value from database if check box or
radio button put it in and also images, i'm trying to make variable
which is save the data for checkbox but still no t works even errors
please see line 14-21 i make comment so you gusy can guide me, but for
all input type text already success
so here is my script, please
review , thanks millions time
-
- //edit
data product
- $('.edit_button').on("click",
function(e) {
-
var id = $(this).data('id');
-
$.ajax({
-
url: base_url + "product/edit/"+id,
-
type: "GET",
-
dataType: "JSON",
-
success: function(data)
-
{
-
- var
a= data.product_status;
-
-
if (a!='') {
-
console.log('status has value');
-
$('#status').prop('checked', true);
-
} else{
-
console.log('status has no value');
-
$('#status').prop('checked', false);
-
}
-
-
$('[name="id_brand"]').val(data.id_brand);
-
$('[name="merk"]').val(data.name_brand);
-
$('[name="id_tipe"]').val(data.id_tipe);
-
$('[name="tipe"]').val(data.name_tipe);
-
$('[name="product_toko"]').val(data.product_toko);
-
$('[name="product_harga"]').val(data.product_harga);
-
$('[name="product_keterangan"]').val(data.product_keterangan);
-
-
$('#modal_form').modal('show'); // show
bootstrap modal when complete loaded
-
$('.modal-title').text('Edit Product');
// Set title to Bootstrap modal title
-
-
},
-
error: function (jqXHR, textStatus, errorThrown)
-
{
-
alert('Error get data from ajax');
-
}
- });
-
});
edit i have success check box then how can i show image in
modal, is it same like checkbox way
- save data in json with variable
- then use jquery to put images with keyword goolging src !
am i right to handle images in modal bootsrap ? thanks