function add_To_DO(){         
         let name= $("#task_Name").val(); 
         let ownerName=$("#task_owner option:selected").html();
         let userId=$("#task_owner option:selected").data("id"); 
         let owner={"userId": userId , "ownerName":ownerName}; 
         let toCompleteDate= formatDate(document.querySelector("#task_date").value);
         let toDoId;
         $.ajax({
            type: "POST",
            url: 'api/addToDo.php',
            data: {name: name, ownerID: userId, DueDate: toCompleteDate, groupId:groupId},
            success: function(response)
            {                                   
                // console.warn(response);
                let jsonData= JSON.parse(response); 

                if(jsonData.success===1)
                {
                    toDoId= jsonData.id;
                    thingsToDo.push({"toDoId":toDoId,"name": name, "owner":owner, "isComplete": 0,"toCompleteDate": toCompleteDate,
                    "groupId":groupId});

                    dateTasks.push(formatDate(toCompleteDate));
                    reload_Date_List();

                    sort_toDo_List(); 
                }
                else if(jsonData.success===0)  
                {
                    alert("somthing went wrong");                          
                }         
            }
        }); 
     }
//Function that Add a new task in the array by the the text fields from the Add-form

Function that Add a new task in the array by the the text fields from the Add-form
Function that Add a new task in the array by the the text fields from the Add - form
function add_To_DO(){         
         let name= $("#task_Name").val(); 
         let ownerName=$("#task_owner option:selected").html();
         let userId=$("#task_owner option:selected").data("id"); 
         let owner={"userId": userId , "ownerName":ownerName}; 
         let toCompleteDate= formatDate(document.querySelector("#task_date").value);
         let toDoId;
         $.ajax({
            type: "POST",
            url: 'api/addToDo.php',
            data: {name: name, ownerID: userId, DueDate: toCompleteDate, groupId:groupId},
            success: function(response)
            {                                   
                let jsonData= JSON.parse(response); 
                if(jsonData.success===1)
                {
                    toDoId= jsonData.id;
                    thingsToDo.push({"toDoId":toDoId,"name": name, "owner":owner, "isComplete": 0,"toCompleteDate": toCompleteDate,
                    "groupId":groupId});
                    dateTasks.push(formatDate(toCompleteDate));
                    reload_Date_List();
                    sort_toDo_List(); 
                }
                else if(jsonData.success===0)  
                {
                    alert("somthing went wrong");                          
                }         
            }
        }); 
     }
function add_To_DO ( ) { let name = $ ( "#task_Name" ) . val ( ) ; let ownerName = $ ( "#task_owner option:selected" ) . html ( ) ; let userId = $ ( "#task_owner option:selected" ) . data ( "id" ) ; let owner = { "userId" : userId , "ownerName" : ownerName } ; let toCompleteDate = formatDate ( document . querySelector ( "#task_date" ) . value ) ; let toDoId ; $ . ajax ( { type : "POST" , url : 'api/addToDo.php' , data : { name : name , ownerID : userId , DueDate : toCompleteDate , groupId : groupId } , success : function ( response ) { let jsonData = JSON . parse ( response ) ; if ( jsonData . success === 1 ) { toDoId = jsonData . id ; thingsToDo . push ( { "toDoId" : toDoId , "name" : name , "owner" : owner , "isComplete" : 0 , "toCompleteDate" : toCompleteDate , "groupId" : groupId } ) ; dateTasks . push ( formatDate ( toCompleteDate ) ) ; reload_Date_List ( ) ; sort_toDo_List ( ) ; } else if ( jsonData . success === 0 ) { alert ( "somthing went wrong" ) ; } } } ) ; }
Function that Add a new task in the array by the the text fields from the Add-form
Function that Add a new task in the array by the the text fields from the Add - form
// console.warn(response);
