JQuery,AJAX:第一次尝试使用AJAX,但无法使用它

时间:2010-12-24 21:51:32

标签: php jquery ajax

尝试让下面的代码工作但成功不会执行 - 错误确实如此。如何获得有关确实出错的更详细信息?我还会在pastebin链接中包含next.php的代码。谢谢。 [next.php:http://pastebin.com/Gnu2AfU8]

$("a#next").click(function()
{
    $.ajax({
           type : 'POST',
           url  : 'next.php',
           dataType : 'json',
           data     : { nextID : $("a#next").attr("rel") },
           success  : function ( data ) {
                      $("img#spotlight").attr("src",data.spotlightimage);
                      $("div#showcase h1").text(data.title);
                      $("div#showcase h2").text(data.subtitle);

                      for(var i=0; i < data.size; i++)
                      {
                          $("ul#features").append("<li>").text(data.feature+i).append("</li>");
                      }

                      $("div#showcase p").text(data.description);

                      for(i=1; j < data.picsize; i++)
                      {
                          $("div.thumbnails ul").append("<li>").text(data.image+i).append("</li>");
                      }

                      $("a#next").attr("rel", $a("a#next").attr("rel") + 1);

           },
           error    : function ( XMLHttpRequest, textStatus, errorThrown) {
                     $("div#showcase h1").text("An error has occured.");
           }
    });
});

1 个答案:

答案 0 :(得分:1)

error    : function ( XMLHttpRequest, textStatus, errorThrown) {
                     $("div#showcase h1").text("An error has occured:" + errorThrown);
           }

告诉我们你得到了什么错误