'ajax update the status so i can see the status of instered data

I have a working a ajax call thats get data form a file and load in to database.

$.ajax({
            xhr: function() {
                // Download progress
                xhr.addEventListener("progress", function(evt){
                    if (evt.lengthComputable) {
                        var percentComplete = (evt.loaded / evt.total)*100;
                        $("#LoadStatus").html("Procent: "+percentComplete+" av "+evt.total+"%");
                    }
                }, false);

                return xhr;
            },
            type: 'POST',
            url: purl,
            data: formdata,
            success: function(data){
                // Do something success-ish
                $("#LoadStatus").html("ALL Availibe data is now in DB");
            }
        });

the function that i call with the API updates a counter of how many rows that have been insterted. YOu have anyideas how i can do this the best way?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source