Issue 1310: Pull json through to page
Status:  Invalid
Owner: ----
Closed:  Aug 2013
Reported by gary.br...@gmail.com, Feb 22, 2012
Hi, I have been trying to display mysql data into fullcalendar for over 8 days now without any success, could someone please show me my errors? I have created the json-events.php file which displays table data ion browser so I think that's fine, the calendar also displays in browser but not with any data from json?

json.html file consist of:

<script type="text/javascript">
	$(document).ready(function() {
	    var date = new Date();
		var d = date.getDate();
		var m = date.getMonth();
		var y = date.getFullYear();
  		 	
$('#calendar').fullCalendar({

    eventSources: [

        // your event source
        {
            url: '/xxjson-events.php' // use the `url` property
        }

    ]

});

</script>

xxjson-events.php consist of:


mysql_select_db($database_ghl_portal, $ghl_portal);
$query_rsXXCal = "SELECT * FROM events";
$rsXXCal = mysql_query($query_rsXXCal, $ghl_portal) or die(mysql_error());
$row_rsXXCal = mysql_fetch_assoc($rsXXCal);
$totalRows_rsXXCal = mysql_num_rows($rsXXCal);mysql_select_db($database_ghl_portal, $ghl_portal);
$query_rsXXCal = "SELECT * FROM events";
$rsXXCal = mysql_query($query_rsXXCal, $ghl_portal) or die(mysql_error());
$row_rsXXCal = mysql_fetch_assoc($rsXXCal);
$totalRows_rsXXCal = mysql_num_rows($rsXXCal);
		$result = mysql_query($query_rsXXCal) or die(mysql_error());

		while($row = mysql_fetch_assoc($result)){
		$eventsArray = array();
             	$eventsArray['title'] = $row['title'];
             	$eventsArray['start'] = $row['start_date'];
             	$eventsArray['end'] = $row['end_date']; 
		}  
		echo json_encode($eventsArray)
?>

Kind Rgerads

Gary
Jul 6, 2012
#1 mihai...@gmail.com
I had the same issue as you. Try encoding this way instead:


$year = date('Y');
	$month = date('m');

	echo json_encode(array(

		array(
			'id' => 111,
			'title' => "Occupational Therapy Appointment",
			'start' => "$year-$month-10 12:30:00",
			'url' => "http://yahoo.com/"
		),

		array(
			'id' => 222,
			'title' => "Physical Therapy Appointment",
			'start' => "$year-$month-20 12:30:00",
			'end' => "$year-$month-22 2:30:00",
			'url' => "http://yahoo.com/"
		)

	));

and then to catch it in your js file:


			eventSources: [

				// your event source
				{
					url: '/json_events.php',
					type: 'POST',
					data: {
						custom_param1: 'something',
						custom_param2: 'somethingelse'
					},
					error: function() {
						alert('there was an error while fetching events!');
					},
				
					color: 'green',   // a non-ajax option
					textColor: 'white' // a non-ajax option
				}

				// any other sources...

			]

Aug 15, 2013
Project Member #2 adamrs...@gmail.com
(No comment was entered for this change.)
Status: ReproTemp
Aug 25, 2013
Project Member #3 adamrs...@gmail.com
This message is being bulk-sent to a number of issues, both [very] old and new.

I have been working on taming this issue tracker, which has gotten out of control after months of neglect. You are receiving this message because I could not successfully reproduce the bug you were reporting with a reasonable amount of effort. I have written some new bug-report guidelines to be used by all bug reports going forward:

    http://arshaw.com/fullcalendar/wiki/Report-a-Bug/

Its salient point is that all bug reports should have an isolated demonstration, viewable online with a tool like JSFiddle.

If the bug you originally reported is still important to you, could you please first try the latest version of FullCalendar and see if it is fixed? If not, could you please file a NEW bug report that follows the new guidelines? This issue will not be monitored for further comments.

I'm sorry I have taken so long to respond to many of your request, and I'm sorry if this new procedure causes extra work for you. Going forward, the issue tracker will be much more of a well-oiled machine.

Again, if you must, PLEASE SUBMIT A *NEW* BUG REPORT (following the new guidelines) INSTEAD OF COMMENTING ON THIS ONE. Further comments on this report will be ignored. Thanks.
Status: Invalid
Labels: Type-Bug