I've try to make a form edit with bootstrap modal and tinymce inside the form, when i clicked edit data. the data is not showing in tinymce, see the image, form modal with tinymce
here is my code
function edit(id){
save_method = "update";
$('#form')[0].reset();
$('.form-body').removeClass('has-error');
$('.help-block').empty();
$.ajax({
url: '<?php echo site_url("profil/ajax_edit/")?>/'+id,
type: 'GET',
dataType: 'JSON',
success: function(data)
{
$('[name="profil_id"]').val(data.profil_id);
$('[name="post_nama"]').val(data.nama);
$('[name="post_jk"]').val(data.jenis_kelamin);
$('[name="post_date"]').val(data.tanggal_lahir);
$('[name="post_kota"]').val(data.id_kota);
$('[name="post_alamat"]').val(data.alamat);
$('[name="post_email"]').val(data.email);
$('[name="post_telepon"]').val(data.telepon);
if (data.profil_status == 'active'){
$(':radio[name=post_status][value="active"]').prop('checked', true);
} else {
$(':radio[name=post_status][value="notactive"]').prop('checked', true);
}
if(data.photo){
$('#photoPreview').html('<img src="'+base_url+'upload/profil/'+data.photo+'" width="75" height="50">');
}
$('#modal_form').modal('show');
$('.modal-title').text('Edit Profile');
},
error: function (jqXHR, textStatus, errorThrown)
{
alert('Error get data from ajax');
}
});
}
You can't have php
inside of js
:
$.ajax({
url: '<?php echo site_url("profil/ajax_edit/")?>/'+id,
Add your path properly.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.