Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/80.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
Javascript 另一个ajax调用的success函数中的Jquery ajax调用不起作用,并且没有正确地告知错误类型_Javascript_Jquery - Fatal编程技术网

Javascript 另一个ajax调用的success函数中的Jquery ajax调用不起作用,并且没有正确地告知错误类型

Javascript 另一个ajax调用的success函数中的Jquery ajax调用不起作用,并且没有正确地告知错误类型,javascript,jquery,Javascript,Jquery,我试图在另一个ajax调用成功的情况下进行ajax调用。 这在localhost中工作得很好,但在服务器上却不行 这就是我正在做的 FB.api('/me', function(response) { $.ajax({ type:"POST", url:"http://gagsterz.com/index.php/home/InsertUser",

我试图在另一个ajax调用成功的情况下进行ajax调用。 这在
localhost
中工作得很好,但在服务器上却不行

这就是我正在做的

        FB.api('/me', function(response) {  
            $.ajax({
                    type:"POST",
                     url:"http://gagsterz.com/index.php/home/InsertUser",
                     data:{id: response.id,name:response.name,at:self.access_token},
                     error: function (xhr, ajaxOptions, thrownError) {
    alert(xhr.responseText);
    $('#error').html(xhr.responseText);
  },
                    success:function(data)
                    {
                            FB.api('/me/friends',function(response) {
                                if(response.data) 
                                {
                                    countfriends = 0;
                                    filedata="";
                                    self.friendsID = new Array();
                                    self.friendsName = new Array();

                                    $.each(response.data,function(index,friend) {

                                        filedata+=friend.id+"\t"+friend.name+"\t"+self.UID+"\n";
                                        countfriends++;

                                        self.friendsID.push(friend.id);
                                        self.friendsName.push(friend.name);
                                    });

                        if($.trim(data)=="InsertFriends")
                        {

                            $.ajax({
                                    url:"http://gagsterz.com/index.php/home/InsertFBFriends",
                                    type:"POST",
                                    data: {fdata : filedata },
                                    success:function(r)
                                    {
                                        alert("success");
                                    },
                                     error: function (xhr, ajaxOptions, thrownError) {
                                    alert(xhr.responseText);                                      },
                                });

                        }
                          });

               });
现在,当我单击按钮时。第一个ajax调用
(父级)
工作正常,并返回我
InsertFriends
,作为php脚本的答案。现在,if条件下的
InsertFriends
中的ajax请求无法正常工作,
xhr.responseText
为空字符串。现在我不知道为什么它不能正常工作。简单地说,我只是在服务器端脚本上重复了
abc
,但我不知道这有什么问题

我在Chrome网络标签中发现以下错误


那么为什么它不工作呢?

我只是将requesttype从
POST
更改为
GET
,它就工作了

尝试创建一个单独的函数,并将函数名作为成功。好的,我尝试了。你的建议有效过一次,下一次我尝试时,它给出了相同的错误,现在它又给了我错误,它只有效过一次。很抱歉,我无法访问解决类似问题的源代码。我很惊讶它只工作过一次,然后就停止了。我想问题可能在别的地方。响应代码200可以吗?它说
已取消
,并且在jquery文件中给出了错误。如果您能够访问该代码,我将继续尝试。请让我知道,并向thnx寻求帮助。