I am using full Calendar latest version and displayed events as hain data successfully. Now when I click on event I am displaying a pop-up containing the event information.
There is a button on pop-up using that I am changing value of that event in database and doing this through AJAX.
Now I want to change background color of that event on success of pop-up submit using AJAX.
How can I achieve that ?
This is code for full calendar
/* Full Calendar */
jQuery(document).ready(function() {
var currenturl=window.location.search;
if(currenturl=='?page=budget_calendar'){
var ajax_url=calendar_ajax_url.cal_lib;
}
jQuery('#calendar').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay,listWeek'
},
buttonText: {today: 'Today', month: 'Month', agendaWeek: 'Week', agendaDay: 'Day',listWeek:'list'},
lang: 'us',
refetch: false,
firstDay: 1,
eventLimit: 2, // allow "more" link when too many events
disableDragging: true,
eventRender: function(event, element) {
element.find('.fc-title').hide();
element.find('.fc-time').hide();
element.find('.fc-title').after(
jQuery("<div><i class='fa fa-money'></i>"+ event.type +" : <br>" + event.title + "</div>"+"<div></div>"+"<div>Amount :" + event.amount + "</div>")
);
element.css('border-color','#0040ff');
element.css('background-color',event.color);
element.click(function () {
var event_id=event.id;
var event_type=event.type;
jQuery.ajax({
type:'POST',
url:ajax_url+'/assets/lib/lib_calendar_ajax.php',
data:{event_type:event_type,event_id:event_id,action:'get_event_details'},
success:function(response){
var eventdata=jQuery.parseJSON(response);
if(event.type=='Expense'){
jQuery('#expenseModal').modal('show');
}
}
})
});
},
events:ajax_url+'/assets/lib/lib_upcoming_calendar.php',
});
});
And on popup button click
`$(document).on('click','#button_click',function(){
var orderid=$(this).data('eventid');
$.ajax({
type:'POST',
url:'ajax_responce.php',
data: {'orderid':orderid,action:'change_status'},
success:function(response){
if(response=='done'){
/* here i want to change background color of event which i have clicked */
}
}
});
});