开发者

JQuery, AJAX: Trying AJAX for the first time but cant get this to work

Trying to get the code below to work but the success doesn't execute - the error does. How can I get more detailed information on what is exactly going wrong? I'll include the code for next.php in a pastebin link also. Thanks. [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.");
           }
    });
});


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

tell us what error you get

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜