I am using following code to populate DropDown:
$(document).ready(function(){
$('#inDistrict').sSelect();
$("#inDistrict").change(function(){
$.getJSON("filldistricts.php",{id: $(this).val(), ajax: 'true'}, function(j){
var options = '';
for (var i = 0; i < j.length; i++) {
options += '<option value="' + j[i].optionValue + '">' + j[i].optionDisplay + '</option>';
}
})
})
})
The code for the file: filldistricts.php is as below:
<?php
require_once("../Lib/dbaccess.php");
$query = "SELECT districtid, districtname FROM districtmaster";
try
{
$result = dbaccess::GetRows($query);
echo json_encode($result);
}
catch(exception $ex)
{
echo "<script type='text/javascript'>alert('".$ex."')</script>";
}
?>
The DropDown is not filling. Where is the problem?
Edited:
DBAccess.php [GetRows function] contains only following code:
$resultSet = mysql_query($inQuery);
return $resultSet;
Connection is opened before the above code.