i’m using autocomplete from jquery… and i have this:
$('#name_search').autocomplete({
source: "search/name.php",
open: function(){
$(this).autocomplete('widget').css('z-index', 1000);
return false;
},
select:function(event, ui){
$(this).val(ui.item.nome+" - "+ui.item.cognome);
fillAnagrafica(ui);
var id = ui.item.id;
$.post("tabella.php",id:id,
function(msg){
$('#tabella').html(msg);
$('#tabella').show();
}
);
return false;
}
}).data( "autocomplete" )._renderItem = function( ul, item ){
return $( "<li></li>" )
.data( "item.autocomplete", item )
.append( "<a>" + item.nome + "<br>" + item.cognome + "</a>" )
.appendTo( ul );
};
My problem is that if i remove the post code:
$.post("tabella.php",id:id,
function(msg){
$('#tabella').html(msg);
$('#tabella').show();
}
);
autocomplete works good.. if i put post code.. autocomplete doesn’t show me text searched.. what could be the problem? can someone help me pls? thanks!
You have a syntax error in the data argument of $.post
Should be
You didn’t not encapsulate your data object in curly braces.
Use a browser console to check errors. A console like Firebug would have pointed out the syntax error and pointed you right at it