dpy3846 2011-09-07 00:45
浏览 96
已采纳

jQuery $ .ajax不起作用

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

                $("#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!

  • 写回答

2条回答 默认 最新

  • dpvmtdu364462 2011-09-07 00:53
    关注

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

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 微信公众号自制会员卡没有收款渠道啊
  • ¥15 stable diffusion
  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
  • ¥15 perl MISA分析p3_in脚本出错
  • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
  • ¥15 ubuntu虚拟机打包apk错误
  • ¥199 rust编程架构设计的方案 有偿