dimanche 10 juillet 2016

How to load data from ajax to zabuto calendar plugin?

As title, I tried load data from ajax to zabuto calendar, but seem it's not working, ref of zabuto calendar http://zabuto.com/dev/calendar/examples/show_data.html

<script>   
$(document).ready(function () {
function load_data() {
                var list = '';
                $.ajax({
                    type: "POST",
                    url: "../BUS/WebService.asmx/LOAD_DATA",
                    contentType: "application/json; charset=utf-8",
                    dataType: "json",
                    cache: false,
                    success: function (data) {
                        list = $.parseJSON(data.d);
                        console.log(list);
                    },
                    error: function (data) {
                        console.log(data.d);
                    }
                });
                return list;
            }

$("#my_calendar").zabuto_calendar({
                data: load_data()
            });

});
    
</script>

When i test this, data not show, the data from ajax as { "date": "2016-06-01", "title": 2, "badge": true }, { "date": "2016-06-03", "title": 1, "badge": true }, { "date": "2016-06-04", "title": 1, "badge": true }, { "date": "2016-06-10", "title": 1, "badge": true },

Aucun commentaire:

Enregistrer un commentaire