Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/79.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/7/elixir/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
第二个JSON帖子似乎没有执行PHP文件_Php_Jquery_Ajax_Call - Fatal编程技术网

第二个JSON帖子似乎没有执行PHP文件

第二个JSON帖子似乎没有执行PHP文件,php,jquery,ajax,call,Php,Jquery,Ajax,Call,因此,在jquery php mysql连接的第一部分中,我将从数据库中获取数据 第一部分工作完美-> 我的代码: $( document ).ready(function() { $( '#create-checklist' ).submit(function( event ) { //console.log("submit:"); var tagList = []; // create empty (json) object $('input[ty

因此,在jquery php mysql连接的第一部分中,我将从数据库中获取数据

第一部分工作完美->

我的代码:

$( document ).ready(function() {

 $( '#create-checklist' ).submit(function( event ) {
    //console.log("submit:");
        var tagList = []; // create empty (json) object
        $('input[type=checkbox]').each(function(){
            if (this.checked) {
                var $this = $(this);
                tagList.push($this.attr("id"));
            }

            event.preventDefault();
        });

        var projectName = $('#insertname').val();

        var tags = JSON.stringify(tagList);
        var projectName = JSON.stringify(projectName);


        $.ajax({        
           type: "POST",
           url: "read_checkboxes.php",
           data: { tags : tags, projectName : projectName
           }, 
           success: function(result) {

               var myTags = result; 
               $('.checklist').html(myTags);
           }


      }); 

  });
但是我有第二个Ajax调用,运行到console.log,然后似乎没有请求update_checklist.php

我正在使用#home.on,因为内容是从第一次调用生成的

 $( '#home' ).on( "click", ".check-todo", function() {

      var currentTodoID = [];
      var $this = $(this);

      var currentTodoID = $this.attr("id");

      var currentTodoID = JSON.stringify(currentTodoID);

      console.log(currentTodoID);


      $.ajax({
        type: "POST",
        url: "update_checklist.php",
        data: {  currentTodoID : currentTodoID
        },
        succes: function(data) {

            var checklistData = data;

            $('.testingdiv').html(checklistData);

        }

      });

  }); 

});
和php,两个echo都不显示:

此文件名为update_checklist.php:

    if(isset($_POST["currentTodoID"])) { 

    echo 'it works'; } else {

        echo 'it doesnt work but works a bit';
    };

您的代码中缺少“s”

  $.ajax({
    type: "POST",
    url: "update_checklist.php",
    data: {  currentTodoID : currentTodoID
    },
    success: function(data) {//in this line

        var checklistData = data;

        $('.testingdiv').html(checklistData);

    }

  });

成功
更改为
成功

几乎一天的工作,我没有看到这一点。非常感谢。我想这一定是因为在对方之后打了两个ajax电话。