diff --git a/jqm.autoComplete-1.3.js b/jqm.autoComplete-1.3.js index 69de483..55b3f28 100755 --- a/jqm.autoComplete-1.3.js +++ b/jqm.autoComplete-1.3.js @@ -80,6 +80,16 @@ return re.test(element_text); }); buildItems($this, data, settings); + } + // Accept a function as source. + // Function needs to call the callback, which is the first parameter. + // source:function(text,callback) { mydata = [1,2]; callback(mydata); } + else if (typeof settings.source === 'function') { + + settings.source(text,function(data){ + buildItems($this, data, settings); + }); + } else { $.ajax({ type: settings.method,