试图把两个javascripts

I'm trying to put two onClick functions, but when i put them together I get an error. And first function ain't working, here is my script. As you can see im trying to call insertData function and then reload page with this function window.location.reload(). Bellow the script there is photo with an error.

if ($canEdit) {
        $s .= ("
\t\t".'<a href="#">'
               . "
\t\t\t".'<img src="./images/icons/tick.png" alt="' . $AppUI->_('Check') 
               . '" border="0" width="12" height="12" onClick="javascript:insertData('. $currentTasken .', '.$currentUser.', \''.$currentSummary.'\', '.$currentPercent.', \''.$currentDescription.'\'); window.location.reload();" />' . "
\t\t</a>");
    }
    $s .= "
\t</td>";
    ?>
    <script type="text/javascript">

    // Note that you should use `json_encode` to make sure the data is escaped properly.
    var currentTasken = <?php echo json_encode($currentTasken=$a['task_id']); ?>;
    var currentUser = <?php echo json_encode($currentUser=$AppUI->user_id); ?>;
    var currentSummary = <?php echo json_encode($currentSummary=$row[0]); ?>;

    function insertData(currentTasken, currentUser, currentSummary, currentPercent, currentDescription)
    {
        if (window.XMLHttpRequest)
        {// code for IE7+, Firefox, Chrome, Opera, Safari
            xmlhttp=new XMLHttpRequest();
        }
        else
        {// code for IE6, IE5
            xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
        xmlhttp.open("POST","modules/tasks/datafile.php",true);
        xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");

        // Here, use the JS variables but, likewise, make sure they are escaped properly with `encodeURIComponent`
        xmlhttp.send("currentUser=" + encodeURIComponent(currentUser) + "&currentTasken=" + encodeURIComponent(currentTasken) + "&currentSummary=" + encodeURIComponent(currentSummary) + "&currentPercent=" + encodeURIComponent(currentPercent)+ "&currentDescription=" + encodeURIComponent(currentDescription));
    }

    </script>

Here is the photo of the error: enter image description here

onClick="javascript:doClickStuff('. $currentTasken .', '.$currentUser.', \''.$currentSummary.'\', '.$currentPercent.', \''.$currentDescription.'\');"

Make you click function call the two functions and then set that as the click event

function doClickStuff(data){
   insertData(data);
}
function insertData(currentTasken, currentUser, currentSummary, currentPercent, currentDescription)
    {
        if (window.XMLHttpRequest)
        {// code for IE7+, Firefox, Chrome, Opera, Safari
            xmlhttp=new XMLHttpRequest();
        }
        else
        {// code for IE6, IE5
            xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
        xmlhttp.open("POST","modules/tasks/datafile.php",true);
        xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");

           //callback to reload page
        xmlhttp.onreadystatechange = function() {
           if (request.readyState == 4 && request.status == 200) {
             window.location.reload();
           }
        }; 
            // Here, use the JS variables but, likewise, make sure they are escaped properly with `encodeURIComponent`
        xmlhttp.send("currentUser=" + encodeURIComponent(currentUser) + "&currentTasken=" + encodeURIComponent(currentTasken) + "&currentSummary=" + encodeURIComponent(currentSummary) + "&currentPercent=" + encodeURIComponent(currentPercent)+ "&currentDescription=" + encodeURIComponent(currentDescription));
    }