Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/82.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/heroku/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php JQuery,AJAX:第一次尝试AJAX,但无法实现_Php_Jquery_Ajax - Fatal编程技术网

Php JQuery,AJAX:第一次尝试AJAX,但无法实现

Php JQuery,AJAX:第一次尝试AJAX,但无法实现,php,jquery,ajax,Php,Jquery,Ajax,试图让下面的代码正常工作,但没有成功执行-错误执行。我怎样才能得到关于到底出了什么问题的更详细的信息?我还将在一个pastebin链接中包含next.php的代码。谢谢[next.php:] $(“下一步”)。单击(函数() { $.ajax({ 键入:“POST”, url:'next.php', 数据类型:“json”, 数据:{nextID:$(“a#next”).attr(“rel”)}, 成功:功能(数据){ $(“img#spotlight”).attr(“src”,data.spo

试图让下面的代码正常工作,但没有成功执行-错误执行。我怎样才能得到关于到底出了什么问题的更详细的信息?我还将在一个pastebin链接中包含next.php的代码。谢谢[next.php:]

$(“下一步”)。单击(函数()
{
$.ajax({
键入:“POST”,
url:'next.php',
数据类型:“json”,
数据:{nextID:$(“a#next”).attr(“rel”)},
成功:功能(数据){
$(“img#spotlight”).attr(“src”,data.spotlightimage);
$(“div#showcase h1”).text(data.title);
$(“div#showcase h2”).text(data.subtitle);
对于(变量i=0;i).text(data.feature+i).append();
}
$(“div#showcase p”).text(data.description);
对于(i=1;j).text(data.image+i).append();
}
$(“a#next”).attr(“rel”),$a(“a#next”).attr(“rel”)+1;
},
错误:函数(XMLHttpRequest、textStatus、errorshown){
$(“div#showcase h1”).text(“发生错误”);
}
});
});

告诉我们您遇到了什么错误

如何发布在错误处理程序中收到的XMLHttpRequest、textStatus和ErrorSprown参数值。这些肯定会说明问题所在。谢谢,在阅读教程时,我完全忽略了这些。向我展示了我在next.php上的一些不正确的东西,比如遗忘的包含;(谢谢!
$("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);
           }