Hi,
I am using Ajax autocomplete in my project. It autosuggests city name in text box.The code works fine on local server, but due to unknown reasons it is not working online.When I viewed page source, no errors were in consol and city list was populated as expected.Can anyone guide me in this issue?Here is part of my code:
<script type="text/javascript">
function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
function getCities(countryid){
jQuery('#loadingimage').show();
jQuery.ajax({
type: "POST",
url: "http://cabsplease.com/wp-content/themes/cabsplease/getdropdown.php",
data: "dropdowntype=country&countryid="+countryid,
success: function(msg){
jQuery('#divCity').html(msg);
jQuery('#loadingimage').hide();
}
});
}
</script>
<script type="text/javascript">
function showlist(){
<?php
$rSql = "SELECT DISTINCT(city_name) FROM tbl_area";
$rResult = mysql_query($rSql);
if(mysql_num_rows($rResult)>0){
$str = '';
$flage = 0;
while($rRow = mysql_fetch_assoc($rResult)){
if($flage == 0) {
$str = "'".$rRow['city_name']."'";
$flage =1;
}
else{
$str = $str.",'".$rRow['city_name']."'";
}
}
}
?>
var months = [<?php echo $str; ?>];
$("#local_pickuparea").autocomplete(months,{
minChars: 0,
max: 12,
autoFill: false,
mustMatch: false,
matchContains: false,
scrollHeight: 220,
formatItem: function(data, i, total){
return data[0];
}
});
$("#mumairport_pickupdroparea").autocomplete(months,{
minChars: 0,
max: 12,
autoFill: false,
mustMatch: false,
matchContains: false,
scrollHeight: 220,
formatItem: function(data, i, total){
return data[0];
}
});
$("#outstation_pickarea").autocomplete(months,{
minChars: 0,
max: 12,
autoFill: false,
mustMatch: false,
matchContains: false,
scrollHeight: 220,
formatItem: function(data, i, total){
return data[0];
}
});
$("#outstation_droparea").autocomplete(months,{
minChars: 0,
max: 12,
autoFill: false,
mustMatch: false,
matchContains: false,
scrollHeight: 220,
formatItem: function(data, i, total){
return data[0];
}
});
}
</script>
<script type='text/javascript' src='<?php bloginfo('template_url');?>/js/jquery.autocomplete.js'></script>
<link rel="stylesheet" type="text/css" href="<?php bloginfo('template_url');?>/css/jquery.autocomplete.css" />
<input type="text" id="local_pickuparea" name="local_pickuparea" value="<?PHP if(isset($_POST['local_pickuparea'])){echo $_POST['local_pickuparea'];} ?>" onkeyup="showlist(this.value);"/>