How to show a loading gif mean while a submit form is being executed JQuery

前端 未结 5 390
甜味超标
甜味超标 2020-12-16 00:59

I\'m trying to show a simple spinner gif meanwhile a submit is being executed (it takes a bit because I have to establish some communications with providers via web services

5条回答
  •  悲哀的现实
    2020-12-16 01:45

    Using the jQuery submit function, you can specify a loading image like this:

    $('#form').submit(function() {
        $('#wait').show();
        $.post('/somepage.htm', function() {
            $('#wait').hide();
        });
        return false;
    });
    

提交回复
热议问题