Kevin, I see what you're trying to do. Its very slick. It leaves the adminCode1 line out if the test if false. Just what I need.
I get a Firebug error - invalid label: for the line ajaxData.adminCode1:$("#hiddenState").val();
Here's the current state of the code
$( "#city" ).autocomplete
({
source: function( request, response )
{
var ajaxData = {
featureClass: "P",
country: $('input[name=country]:checked').val(),
style: "full",
maxRows: 10,
name_startsWith: request.term
};
if($('input[name=country]:checked').val()==="US")
ajaxData.adminCode1: $("#hiddenState").val();
$.ajax(
{
url: "http://ws.geonames.org/searchJSON",
dataType: "jsonp",
data: ajaxData,
success: function( data )
{
response( $.map( data.geonames, function( item )
{
return{
label: item.name + (item.adminName2 ? ", " + item.adminName2 : "") + (item.adminName1 ? ", " + item.adminName1 : "") + ", " + item.countryName,
value: item.name + (item.adminName2 ? ", " + item.adminName2 : "") + (item.adminName1 ? ", " + item.adminName1 : "")
}
}));
}
});
},