I can not execute my c # function through the materialize framework autocomplete. It does not run and returns no errors. With bootstrap it works.
I'm using asp.net without codebehind, all in the same file.
I can call the function through the chrome console, but not autocomplete.
call javascript:
$('#autocomplete-input').autocomplete({
data: function (request,response){
PageMethods.GetAllSavedAddress("nextel", function (datax) {
console.log("teste"); //ESSA LINHA TERIA QUE FUNCIONAR INDEPENDENTE DO RETORNO DO METODO
return response(datax);
})
},
limit: 20,
onAutocomplete: function(val) {
console.log(val);
},
minLength: 1,
});
I put a console.log right after the pagemethod call, but even that does not work.
I created a JS function to call through the console and it works perfectly:
function TesteX() {
PageMethods.GetAllSavedAddress($('#autocomplete-input').val(), onSucess, onError);
function onSucess(result) {
alert(result);
}
function onError(result) {
console.log('Something wrong.');
}
}
I know the error is in this part because if I pop in the hand it works. Example:
$('input.autocomplete').autocomplete({
data: {
"Apple": null,
"Microsoft": null,
"Google": null
},
limit: 20,
onAutocomplete: function(val) {
// Callback function when value is autcompleted.
},
minLength: 1,
});
A very welcome help, rs.