-
Notifications
You must be signed in to change notification settings - Fork 4
Using custom properties
jmarnold edited this page Jul 7, 2012
·
1 revision
It can be handy to pass custom information along to your policies (metadata, jquery objects, etc.). Any options passed along are made available via the options
property on the continuation.
There are two ways to do this:
If you are making a simple $.ajax post, you can pass an options
object:
$.ajax({ options: { customProperty: '1234' } })
If you are using the correlatedSubmit method, any properties you specify will be used as options:
$('#myForm').({ customProperty: '1234' })
The following is an example of a policy consuming the options:
{ matches: function(continuation) { return typeof(continuation.options.customProperty) != 'undefined'; }, execute: function(continuation) { alert(continuation.options.customProperty); } }