access the data from ajax response.!
Is there any body i need little help plz. I’m trying to access ‘id’ from ajax response that is coming from database (in row_array()) but when when i alert it or console it i only get single bracket ( { ). Thanks!
$.ajax({
type : 'post',
url : '<?php echo site_url() ?>main_controller/verify_email_for_password_reset',
data : {
verify : verify
},
success : function(data)
{
var html = '<button type="button" id="change_password" data-id = "'+data+'" class="btn btn-block btn-hero btn-noborder btn-rounded btn-alt-success"><i class="si si-user-follow mr-10"></i> Change</button>';
$('#test').html(html);
}
});
});
$('#test').on('click','#change_password',function(){
var id = $(this).data('id');
alert(id);
Go to Source
Author: Abdul Basit