I am trying to chain ajax calls: when i load html content in all element i want load it in others. I would want to do without hardcode the calls in each element with closures attached to the local ajax events. I tried to do with global ajax events like so:
$("#elem2").ajaxSuccess(function(e,x,opts) {
var myUrl="server/elem2"
if(conditionToAvoidRecursiveCalls)
$(this).load(myUrl)
})
but i dont get how to define the conditionToAvoidRecursiveCalls: e.target!=this dont work and opts.url!==url dont avoid mutually recursive calls.
Is there another clever way?