Detect when user clicks link, but aborts

后端 未结 6 1766
暖寄归人
暖寄归人 2020-12-07 03:15

I am working on a Web CMS. When the user clicks on a link to move to a different page, or submits a form, I want a "please wait" animated GIF to show up in the top

6条回答
  •  感动是毒
    2020-12-07 03:50

    (Yep, I do like old topics)

    I'm facing the same situation here. I'm building some pages where the navigation is done through form submitting, and I find convenient to show clearly to the user that something is happening before he gets exited and triggers 15 times the same request - "We don't trust users, do we?"

    So I use jQuery along with a nice plug-in maned Impromptu, available there http://trentrichardson.com/Impromptu/index.php

    Here is the piece of code:

    $(document).ready( function () {
    
     $("form").submit( function() {
      $.prompt( "
    Sending request...
    ", { overlayspeed: 200, buttons:{} }); setTimeout( "jQuery.prompt.close()", 2000 ); }); });

提交回复
热议问题