Not being able to use AUI select2 data or ajax features

When I use auiSelect2 and provide the ajax parameter the auiSelect2 control just fails outright to initialize.

<script>
	 AJS.$("#pq_UsersSel").auiSelect2(
		{
			placeholder: "Search for a User",
			minimumInputLength: 2,
            ajax: {
			 url: 'https://devtools.myserver.org/jira/rest/api/2/user/search',
			 data: function (params) {
			 var query = {
			 username: params.term
			}
		
		});