jstayton/jquery-marcopolo — pull request #23 by lwe (2013-05-15 09:42:30+00:00)
Title: Allow options.data to accept a function

Thanks for this awesome plugin, it really has simplified building autocompletes in a quite few of projects for me.

Sometimes it's required to provide dynamic data, like excluding items or similar things. The current solution is to manually update the `data` option after an item has been selected or a similar change:

```javascript
$input.marcoPolo('option', 'data', { without: selected.join(',') })
```

To simplify providing this, this PR adds all necessary changes to allow options.data to accept a function, so this could be rewritten as:

```javascript
$input.marcoPolo({
url: '/marco/polo',
data: function($inp, query) {
return { without: selected.join(',') };
}, ...
});
```

Of course the existing functionality by providing just an object or string still works as expected.

PS: I only commited the changed source file, but it build works fine and I'm actually already using my custom build in a project.