JQuery, AJAX: Trying AJAX for the first time but cant get this to work...
- by fwaokda
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.");
}
});
});