// ONly for old account
$(document).ready(function(){
// Show Input element
$('.reminder').click(function(e){
console.log("HAHA");
// if (e.target == this) {
$('.reminderedit').hide();
$(this).next('.reminderedit').show().focus();
$(this).hide();
// }
});
// Save data
$(".reminderedit").focusout(function(){
//console.log("BUHU");
// Get edit id, field name and value
var id = this.id;
var split_id = id.split("_");
var field_name = split_id[0];
var edit_id = split_id[1];
var value = $(this).val();
var portfolio = $(this).attr('portfolio');
// Hide Input element
$(this).hide();
// Hide and Change Text of the container with input elmeent
$(this).prev('.reminder').show();
$(this).prev('.reminder').text(value);
// Sending AJAX request
$.ajax({
url: '/reminder_update.php',
type: 'post',
data: { field:field_name, value:value, id:edit_id, portfolio:portfolio },
success:function(response){
if(response == 1){
console.log('Save successfully');
}else{
console.log("Not saved.");
}
}
});
});
});