jquery - FullCalendar - How to save all new added/edited events in a JSON file with Javascript? -


i'm trying write same json file i've retrieved old events, new added/edited events of fullcalendar. i'm working on java swing application.

can please me javascript function i'm using save onclick? or please tell me why not working?

here javascript:

 function savedata(){     $(document).ready(function () {         $(function () {             $("#save").click(function () {                 var eventsfromcalendar = $('#calendar').fullcalendar('clientevents');                 alert(eventsfromcalendar);                 $.ajax(                     {                         url: 'json/prescribedworkouts.json',                         type: 'post',                         traditional: true,                         data: { eventsjson: json.stringify(eventsfromcalendar) },                         datatype: "json",                         success: function (response) {                             alert(response);                         },                         error: function (xhr) {                             debugger;                             alert(xhr);                         }                      });             });         });     }); } 

here html:

<div id='calendar' align="right"></div>     <div id="save" class="save" align="right"><a href="" onclick="savedata()">         <img src="../images/savechangesbutton-normal.png" alt="save changes"              onmouseover="this.src='../images/savechangesbutton-hover.png'"              onmouseout="this.src='../images/savechangesbutton-normal.png'"         /></a></div> 

or there better way of saving events in json file?

any appreciated. thank you.


Comments

Popular posts from this blog

angular - Is it possible to get native element for formControl? -

unity3d - Rotate an object to face an opposite direction -

javascript - Why jQuery Select box change event is now working? -