Hello, I have a problem with the autocomplete, I need to load 5000 records(options) from my database or more but when the textfield is loading my computer take a lot of time to load the options, may be my way to do it is not efficient,
here is my source, and please what is the best way?
JS
function buscar_dx_principal(){
$.ajax({
type: 'GET',
async:false,
url: 'facturacion/nuevas_facturas/cargar_dx_principal.php',
success: functionbb(data){
dx_principal=data.split(",");
}
});
return dx_principal;
}
$( "#txt_dx_principal" ).autocomplete({
source: buscar_dx_principal()
});
PHP
<?php
include('../../common/adodb/adodb.inc.php');
include('../../common/conexion.php');
$cmd = ADONewConnection($bd_driver);
$cmd->Connect($bd_servidor,$bd_usuario,$bd_clave,$bd_base);
$sql="SELECT id,desc FROM tb_rge";
$rs = $cmd->Execute($sql);
$dx_principal="";
while (!$rs->EOF) {$dx_principal=$dx_principal.$rs->fields['id']."-".$rs->fields['desc'].",";
$rs->MoveNext();
}
$cmd->Close();
$dx_principal=substr($dx_principal,0,strlen($dx_principal)-1);
echo utf8_encode($dx_principal);
?>