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

                if(jsonData.success===1)
                {
                    let id= jsonData.id;
                    dateTasks=[];
                    for(let i=0;i<thingsToDo.length;i++)
                        dateTasks.push(formatDate(thingsToDo[i].toCompleteDate));
                    reload_Date_List();
                }
                else if(jsonData.success===0)  
                {
                    alert("somthing went wrong");                          
                }         
            }
        }); 

         sort_toDo_List();   
     }
//Function that Update a task in the array by the text fields from the Update-form

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