D
D
Dmitry2016-06-17 21:11:24
JavaScript
Dmitry, 2016-06-17 21:11:24

Appearance of element on completion of AJAX?

When submitting the form successfully, you need to have such a check mark next to the button for a couple of seconds: 2c0d4af0817f432ab7ba8cb326ad7227.png

Why .show()doesn't it work? CSS span-a How to make it appear for a couple of seconds?span {display: none; }

$("#contact_form-message").submit(function() {
    $.ajax({
        url: "some url", 
        method: "POST",
        data: $(this).serialize(),
        dataType: "json"
    }).done(function() {
        $('.input-submit span').show();
        $("#contact_form-message").trigger("reset");
    });		
    return false;
});

Answer the question

In order to leave comments, you need to log in

2 answer(s)
O
Oleg Pavlov, 2016-06-17
@letehaha

Set timeout
alljs.ru/articles/timeout/overview
setTimeout($('.input-submit span').hide();, 2000);

A
Anton Tsepkovsky, 2016-06-18
@Zippovich

it’s better to do this on css, of course - instead of show, you hang a class that, using keyframes and animation, will show a checkbox for 2 seconds ( https://developer.mozilla.org/ru/docs/Web/CSS/CSS_...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question