0

Screen lock via only JS

asked 2013-05-28 08:57:53 +0800

icju gravatar image icju
1

Does is possible to lock screen using ONLY JS (i mean not via Clients.showBusy etc..). I need to lock screen immediately.

delete flag offensive retag edit

Comments

Do you want for each ajax request the page show some busy mask?

sjoshi ( 2013-05-28 10:37:18 +0800 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2013-05-28 13:38:11 +0800

psingh gravatar image psingh flag of India
963 8

You can just show / hide a gif, but you can also embed that to ajaxSetup, so it's called on every ajax request.

$.ajaxSetup({
    beforeSend:function(){
        // show gif here, eg:
        $("#loading").show();
    },
    complete:function(){
        // hide gif here, eg:
        $("#loading").hide();
    }
});

One note is that if you want to do an specific ajax request without having the loading spinner, you can do it like this:

$.ajax({
   global: false,
   // stuff
});

That way the previous $.ajaxSetup we did will not affect the request with global: false.

More details available at: http://api.jquery.com/jQuery.ajaxSetup

link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
1 follower

RSS

Stats

Asked: 2013-05-28 08:57:53 +0800

Seen: 14 times

Last updated: May 28 '13

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More