c# - my jquery showing this error? -
i trying list of user data web service file called via ajax. here code :
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" /> <script src="http://code.jquery.com/jquery-1.9.1.js"></script> <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script> <script type="text/javascript"> var param; var resultarr; $(document).ready(function () { param = document.getelementbyid('mainct_dtvjobvac_pic').value; // load countries initialize plugin: $.ajax({ type: 'post', contenttype: 'application/json;', data: '{keyword:' + json.stringify(param) + '}', datatype: 'json', url: 'svcaduser.asmx/getaduserlist', success: function (result) { //alert(result.d) resultarr = result.d; } }) // initialize autocomplete local lookup: $('#mainct_dtvjobvac_pic').autocomplete({ source: resultarr }); }); </script>
resultarr
output array values :
[ "administrator", "guest", "krbtgt", "phendy" , "genin" , "hendra" , "andri" ]
it throws this:
typeerror: this.source not function [break on error] this.source( { term: value }, this._response() );
what need fix here? struggling on 2 days, appreciated.
move autocomplete initialization inside ajax success callback:
success: function (result) { //alert(result.d) resultarr = result.d; $('#mainct_dtvjobvac_pic').autocomplete({ source: resultarr }); }
Comments
Post a Comment