Skip to content

A JavaScript-based locking mechanism to easily prevent multiple, unwanted AJAX requests to a Lift server.

License

Notifications You must be signed in to change notification settings

petercoons/Lift-AJAX-Request-Locker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

About:

This is a JavaScript based method of preventing multiple AJAX requests to a Lift server. The method works by checking for the lift_ajaxHandler method, then overwriting it with a custom method that will lock/unlock based on the Lift-generated UID. If the call is locked, we will prevent more calls of the same type from being submitting. If the call is not locked, we proceed as normal.

We also hijack the theSuccess and theFailure callbacks to do the unlocking, but otherwise they will behave normally.

Usage:

  1. Import locker.js in your Lift page (preferably in the head)
  2. Assign a special class to the element that will invoke your AJAX request.

a. l_callOnce - Allows one instance of that AJAX call to be invoked once

b. l_callAndWait - Allows one instance of that AJAX request to be sent at one time. It waits for that call to return, then allows another call.

Requirements:

  1. jQuery
  2. Lift

License:

Licensed under the Apache 2.0 license.

Credits:

Created by Peter Coons for Audax Health

About

A JavaScript-based locking mechanism to easily prevent multiple, unwanted AJAX requests to a Lift server.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published