Need Help With JQuery.deferred
Hello Everyone:
I hope this question is in the right forum. I'm using jQuery fullCalendar and having trouble with asynchronous execution preventing a proper refetchEvents. In research I found out about jQuery.deferred, but can't seem to properly execute a refetchEvents AFTER posting new events to the php file. Following is my script as it now stands:
- // Now that you've grabbed returned data from ol_LogEdits.php and created arrays, send the new arrays to ol_postActivity.php for INSERTing
- $.post("ol_postActivity2.php",{activityAry:extendArry, participantArry:extendParticipants},function(data){
- })
- .done(function (response) {
- //Our JSON response will come back with an http status of 200,
- // so we have to handle our errors in the "done" (success)
- // callback of the promise returned by post().
- if (response.error) {
- console.log("An error occurred");
- } else {
- $('#calendar').fullCalendar( 'refetchEvents' );
- console.log("Success!");
- }
- })
- .fail(function (response) {
- //This gets executed on failing http status codes (e.g. 400)
- console.log("A server error occured (failing http status code)");
- });
The console log is reporting "Success" from line 12. And I can see the calendar refresh, but the newly added events are not showing up on the calendar.
What am I doing wrong, the new data is INSERTING into the appropriate table, it's just that the calendar is not refetching it. I can only assume that it is because of asynchronous execution. So... why isn't the deferred taking care of the issue?
Thanks in Advance - Pavilion