使用ajax和php重置错误加载图像

Hello I'm trying to save images using Ajax and PHP. When I show the result of the errors, the errors are added to the previous ones. I want to reset all errors when you try to load new images. How would I reset errors?

$(document).ready(function()
{

    var formdata = false;
    var action=$("#form-utilizzi").attr("action")

    if (window.FormData) 
    {
            formdata = new FormData();

    }

    $("#images-utilizzi").change(function() 
    {

            $("#result-temp").html("Sto caricando...");
            $("#result-temp").fadeIn(800);
            var i = 0, len = this.files.length, img, reader, file;

            for ( ; i < len; i++ ) {
                    file = this.files[i];


                            if ( window.FileReader ) 
                            {
                                    reader = new FileReader();
                                    reader.onloadend = function (e) 
                                    { 
                                            showUploadedItem(e.target.result, file.fileName);
                                    };
                                    reader.readAsDataURL(file);
                            }
                            if (formdata) 
                            {
                                    formdata.append("images[]", file);
                            }

            }

            if (formdata)
            {

                    $.ajax({
                            url: action,
                            type: "POST",
                            data: formdata,
                            processData: false,
                            contentType: false,
                            success: function (res) {
                                    $("#result-temp").html(res);
                                    $("#result-temp").delay(2000).fadeOut(500,function()
                                    {
                                         $("#result-temp").html("Sto caricando...");
                                    });
                            }
                    });
            }
    });

});