第二个JSONPOST似乎没有执行PHP文件


Second JSON POST seems not to be executing the PHP file

所以我在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,两个回波都没有显示:

此文件名为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);
    }
  });

succes更改为success