I'm trying to implement an autocomplete field.
I want this autocomplete to retrieve the data from my controller (ObtenerOrdenesCompra).
However it doesn't even call the function on the controller.
$('#Asignacion_Movimiento_OrdenCompra').autocomplete({
url: '/Asignaciones/ObtenerOrdenesCompra?Serial=' + $("#Asignacion_Movimiento_Material").val(),
width: 300,
max: 10,
delay: 100,
cacheLength: 1,
scroll: false,
highlight: false
});
If i take a look into the source code of my generated html, it shows:
<input type="text" value="" name="Asignacion.Movimiento.OrdenCompra" id="Asignacion_Movimiento_OrdenCompra" autocomplete="off" class="ac_input input-validation-error">
Why is setting the autocomplete option off?
Any ideas?
I am not sure if this is a copy paste error but you are missing {
in autocomplete options object. If it doesn't fix, make sure that URL is working outside the plugin and see if there are any 404
.
EDIT
$('#Asignacion_Movimiento_OrdenCompra').autocomplete({
url: '/Asignaciones/ObtenerOrdenesCompra',
width: 300,
extraParams: {'Serial', $("#Asignacion_Movimiento_Material").val()},
max: 10,
delay: 100,
cacheLength: 1,
scroll: false,
highlight: false
});
Also note that the value you entered in the text field always comes as q
parameter.