Created
October 8, 2012 17:32
-
-
Save boh1996/3853777 to your computer and use it in GitHub Desktop.
Bootstrap Async Example
This file contains 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
modal.find('[data-handler="'+ key +'"]').each(function (i, currentElement) { | |
currentElement = $(currentElement).find(".typeahead"); | |
currentElement.typeahead({ | |
source: function (typeahead,query) { | |
var url = tableCreator.buildHandlerUrl(handler); | |
if (typeof handler.query_key != "undefined" && query != null && query != "") { | |
if (url.indexOf("?") != -1) { | |
if (url.indexOf("&") != -1) { | |
url += handler.query_key + "=" + query + "&"; | |
} else { | |
url += handler.query_key + "=" + query + "&"; | |
} | |
} else { | |
url += "?" + handler.query_key + "=" + query; | |
} | |
} | |
if (url != null && url.indexOf("&") != -1) { | |
url = url.slice(0,url.length-1); | |
} | |
url = tableCreator.createAutherizedUrl(url); | |
if (url != null && url != undefined) { | |
return $.get(tableCreator.createAutherizedUrl(url),function (data) { | |
if (objx.get(handler,"response_key") != null) { | |
data = data[handler.response_key]; | |
return typeahead.process(data); | |
} | |
}); | |
} | |
}, | |
property: handler.property, | |
}); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment