javascript - mockjax loader - stop from running for specific function -


i making use of jonathan sampson's answer jquery busy loader. works 100% , detects jquery posting or , shows loader.

my problem times want user wait when fetch info database happy loader appear.

what want however, functions loader not show when save info database.

the fiddle can found here

for example, below causes loader run. how can modify mockjax knows not run function only?

$(document).on("click", function(){     $.get("/mockjax");         }); 

thanks always.

short version (with code)

click heading - animation

click paragraph - no animation

http://jsfiddle.net/hps2v/

$.ajax({     url: "/mockjax",     type: "get",     global: false //this key }); 

--

the longer version

there great variable available in $.ajax() method let's stop ajax events firing (but not ajax itself). called global. docs

global (default: true)

type: boolean

whether trigger global ajax event handlers request. default true. set false prevent global handlers ajaxstart or ajaxstop being triggered. can used control various ajax events.

with in mind, have changed code little demonstrate how can make work.

1) moved ajax call function 2 parameters: url , eventtrigger. want url "/mockajax", , eventtrigger true or false (depending on if , when want show animation)

2) took event handler off $(document) , added 2 events heading tags , p tags can demonstrate ajax working in 2 places same code (1 , 1 without animation)

hope helps!


Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -