我想实现什么? - >我需要从sql中追加值标题和url。如何从php获取数据并将其传递到另一个oojs
$('#calendar').fullCalendar({
defaultDate: '2017-06-12',
editable: true,
eventLimit: true, // allow "more" link when too many events
events: [
{
"title": "Click for Google",
"url": "http://google.com/",
"start": "2017-06-28"
}]
我试过了吗? - >
$.ajax({
type: 'GET',
url: 'eventcalendar.php',
dataType:'JSON',
success: function(response) {
console.log(response[0]);
return response;
}
});
我得到了什么? - >
{"title":"Example","start":"2017-06-21","end":"2017-06-
22","url":"http:\/\/www.facebook.com"}{"title":"Holiday","start":"2017-06-
23","end":"2017-06-24","url":"http:\/\/www.google.com"}
我的PHP代码: - >
<?php
error_reporting(0);
include 'announcements/db.php';
$sql = mysql_query("select title, start, end, url from eventcalendar");
$num_rows = mysql_num_rows($sql);
$userinfo = array();
while ($row_user = mysql_fetch_assoc($sql)) {
$userinfo[] = $row_user;
}
echo json_encode($userinfo);
?>
我需要从MySQL获得的价值和更新的事件中:使从SQL所有的标题标签会显示
*我是一个新手,这是我的第一个代码。如果您有更好的选择,请提供帮助和建议。万分感谢 !!
*我是一个新手,这是我的第一个代码*浏览PHP手册,那么你将了解到'mysql_ *'函数已折旧并不再受支持 –
@MasivuyeCokile感谢您的信息。你能帮助上面的代码吗? –