jQuery and array of objects

Posted by sepoto on Stack Overflow See other posts from Stack Overflow or by sepoto
Published on 2012-12-12T22:41:14Z Indexed on 2012/12/12 23:03 UTC
Read the original article Hit count: 249

Filed under:
|
|
|
|
    $(document).ready(function () {

    output = "";

    $.ajax({

        url: 'getevents.php',

        data: { ufirstname: 'ufirstname' },

        type: 'post',

        success: function (output) {

            alert(output);

            var date = new Date();
            var d = date.getDate();
            var m = date.getMonth();
            var y = date.getFullYear();

            $('#calendar').fullCalendar({
            header: {
            left: 'prev,next today',
            center: 'title',
            right: 'month,basicWeek,basicDay'
            },
            editable: true,
            events: output
            });
        }
    });





});

I have code like this and if I copy the text verbatim out of my alert box and replace

events: output

with

events: [{ id: 1, title: 'Birthday', start: new Date(1355011200*1000), end: new Date(1355011200*1000), allDay: true, url: 'http://www.yahoo.com/'},{ id: 2, title: 'Birthday Hangover', start: new Date(1355097600*1000), end: new Date(1355097600*1000), allDay: false, url: 'http://www.yahoo.com'},{ id: 3, title: 'Sepotomus Maximus Christmas', start: new Date(1356393600*1000), end: new Date(1356393600*1000), allDay: false, url: 'http://www.yahoo.com/'},]

Everything works just fine. What can I do to fix this problem? I though that using events: output would place the text in that location but it does not seem to be working.

Thank you all kindly in advance for any comments or answers!

© Stack Overflow or respective owner

Related posts about php

Related posts about JavaScript