jQuery $ .ajax不起作用

时间:2011-09-07 00:45:45

标签: php jquery ajax

我使用jQuery插件fullcalendar写了一个代码,一切正常,直到我在eventClick中发送$ .ajax请求。

我试图提醒事件中的某些内容并且它有效,但是ajax请求不起作用。 js代码:

            !function($)
        {

            $(document).ready(function() {

                $("#eventDialog").dialog({
                    autoOpen : false,
                    modal : true
                });

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

                $("#calendar").fullCalendar({

                    theme : true,

                    header : {
                        left : 'next,prev today',
                        center : 'title',
                        right : 'month,agendaWeek,agendaDay'
                    },

                    editable : false,

                    events : [
                        <?php
                            while ($event = mysql_fetch_array($selectevents))
                            {
                                $startd = explode(".", $event['start']);
                                $endd = explode(".", $event['end']);

                                $starth = explode(":", $event['starth']);
                                $endh = explode(":", $event['endh']);
                        ?>
                        {

                            id : <?php echo $event['id']; ?>,
                            title : '<?php echo stripslashes($event['title']); ?>',
                            <?php
                                if ($event['allday'] == 1)
                                {
                            ?>
                            start : new Date(<?php echo $startd[2]; ?>,<?php echo $startd[1]-1; ?>,<?php echo $startd[0]; ?>),
                            end : new Date(<?php echo $endd[2]; ?>,<?php echo $endd[1]-1; ?>,<?php echo $endd[0]; ?>)
                            <?php
                                }
                                else
                                {
                            ?>
                            start : new Date(<?php echo $startd[2]; ?>,<?php echo $startd[1]-1; ?>,<?php echo $startd[0]; ?>,<?php echo $starth[0]; ?>,<?php echo $starth[1]; ?>),
                            end : new Date(<?php echo $endd[2]; ?>,<?php echo $endd[1]-1; ?>,<?php echo $endd[0]; ?>,<?php echo $endh[0]; ?>,<?php echo $endh[1]; ?>),
                            allDay : false
                            <?php
                                }
                            ?>
                        }
                        <?php
                                $evNum--;
                                if ($evNum > 0)
                                    echo ",";
                            }
                        ?>
                    ],

                    eventClick : function(event) {

                        var eid = event.id;

                        $.ajax({
                            type : "GET",
                            url : "getEvent.php",
                            data : "id=" + eid,
                            succuss : function(msg) {

                                var title = $("event title", msg).text();
                                var description = $("event description", msg).text();
                                var start = $("event start", msg).text();
                                var end = $("event end", msg).text();
                                var starth = $("event starth", msg).text();
                                var endh = $("event endh", msg).text();

                                $("#eventDialog").attr("title", title);
                                $("#eventDialog #edDescription").html(title);

                                eventDialog.dialog("open");

                            }
                        });

                    }

                });

            });

        }(jQuery);

getEvent.php

    $id = htmlspecialchars(mysql_real_escape_string($_GET['id']));

$selectevent = mysql_query("SELECT * FROM `calendar` WHERE `id`='$id'") or die(mysql_error());
$event = mysql_fetch_array($selectevent);

header("Content-Type: text/xml; charset=utf-8");
echo '<?xml version="1.0" encoding="utf-8" ?>';

echo "<event>";
echo "<id>".$event['id']."</id>";
echo "<title>".stripslashes($event['title'])."</title>";
echo "<description>".$event['description']."</description>";
echo "<start>".$event['start']."</start>";
echo "<end>".$event['end']."</end>";
echo "<starth>".$event['starth']."</starth>";
echo "<endh>".$event['endh']."</endh>";
echo "</event>";

有人可以指出问题吗?

感谢的!

2 个答案:

答案 0 :(得分:1)

多汁?,我猜这是你的问题,应该是“成功”

答案 1 :(得分:1)

在您的代码中将succuss更改为success,它必须是拼写错误。

由于jQuery $.ajax在其设置中未找到success处理程序,因此无法执行任何操作。