juppix: Wieder mal: Problem mit JSON/Ajax

Beitrag lesen

Du bist einfach klasse!

10000 Dank ✌️

Es funktioniert 😀 :

yearChanged: function(e) {		
		
			e.preventRendering = true;			

			$(e.target).append('<div style="text-align:center"><img src="./img/loading_spinner.gif" /></div>');

			var jqTextToJson = {
				  "text json": function(jsonString) {
					return JSON.parse(jsonString,
						function(name, value) {
							if (name === "startDate" || name === "endDate")
								return new Date(value);
							return value;
					});
			    }
			 };
			
			$.ajax({
				dataType: "json",
				url: "./calendar_data_test.php", 
				converters: jqTextToJson,
				success: function(dataSource) {  
					$(e.target).data('calendar').setDataSource(dataSource);
				} 			    
			});		
		}

... und die PHP (unverändert):

<?php
$out = array();

 for($i=1; $i<=15; $i++){     //from day 01 to day 15
    $data = date('Y-m-d', strtotime("+".$i." days"));
    $out[] = array(  
		'id' => $i,
        'name' => 'Event name '.$i,
		'location' => 'location',
        'startDate' => '2018-05-01',
        'endDate' => '2018-09-20'
    );
}

echo json_encode($out);
exit;
?>