Last active
August 29, 2015 14:09
-
-
Save JoshDoody/174444519da0f8f970f4 to your computer and use it in GitHub Desktop.
Dynamic URL with jQuery TokenInput
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $(function() { | |
| $(".submission_user_select").tokenInput(getSearchURL, { | |
| crossDomain: false, | |
| prePopulate: $("#submission_user_id").data("pre"), | |
| hintText: "Type a member name...", | |
| tokenLimit: 1, | |
| propertyToSearch: "full_name", | |
| placeholder: "Type a member name...", | |
| theme: "facebook", | |
| resultsFormatter: function(item){ return "<li>" + item[this.propertyToSearch] + "</li>" }, | |
| preventDuplicates: true }); | |
| }); | |
| function getSearchURL() { | |
| return "/teams/"+$(".submission_user_select").attr('data-team-id')+"/team_members.json"; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment