当我单击编辑数据时,我尝试在表单中使用bootstrap modal和tinymce进行表单编辑。数据未显示在时间符号中,请参阅图像form modal with tinymce
以下是我的代码
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');
}
});
}
发布于 2017-01-06 03:41:21
您不能在js
中使用php
$.ajax({
url: '<?php echo site_url("profil/ajax_edit/")?>/'+id,
正确添加您的路径。
https://stackoverflow.com/questions/41498483
复制相似问题