开发者

jQuery $.ajax does not work

I wrote a code using jQuery plugin fullcalendar, and everything worked just fine, until I send an $.ajax request in the eventClick.

I tried to alert something in the eventClick and it worked, but the ajax request just doesn't work. js code:

            !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();

                $开发者_Python百科("#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>";

Can anybody point out the problem?

Thank's!


succuss??, i guess is this your problem , it should be "success"


Change succuss to success in your code it must be a typo.

Since jQuery $.ajax did not find the success handler in its settings it didn't do anything.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜