Rofi Fathurrohman Rofi Fathurrohman - 2 months ago 20
Ajax Question

Ajax Load file without blinking

i'm developing a web page, inside there are auto load data, the script I took in tutorial website, but its weakness, text always blink every few seconds, if it can be made so as not to be blinking? I'm beginner for Ajax, and it makes me confused.

Here's code:

function loadValue5() {
$.ajax({
method: 'GET',
url: 'grab_count_old.php',
success: function(responseText) {
$('#amt').fadeOut('fast', function () {
$('#amt').val(responseText).fadeIn('fast', function() {
setTimeout(loadValue5, 100);
});
});
}
});
}
loadValue5();

Answer

remove the fade effects

function loadValue5() {
    $.ajax({
        method: 'GET',
        url: 'grab_count_old.php',
        success: function(responseText) {
                $('#amt').val(responseText);
                setTimeout(loadValue5, 100);
        }
    });
}
loadValue5();
Comments