Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64
Your IP : 18.219.107.243
function PopulateMonthYear(year_id, month_id) {
$.ajax({
type: "POST",
async: false,
url: $host_url + "getMonthYear",
success: function PopulateMonthYearResponce($responce) {
$responce = eval("(" + $responce + ")");
if ($responce.error_code == "0") {
document.getElementById(year_id).options.length = 0;
$op = new Option("Select One", "0");
$op.id = "0";
document.getElementById(year_id).options.add($op);
for ($i = 0; $i < $responce.data["year"].length; $i++) {
$op = new Option(
$responce.data["year"][$i]["year"],
$responce.data["year"][$i]["internal_code"]
);
$op.id = $responce.data["year"][$i]["internal_code"]; //specifying the id for options
document.getElementById(year_id).options.add($op);
}
document.getElementById(month_id).options.length = 0;
$op = new Option("Select One", "0");
$op.id = "0";
document.getElementById(month_id).options.add($op);
for ($i = 0; $i < $responce.data["month"].length; $i++) {
$op = new Option(
$responce.data["month"][$i]["month_name"],
$responce.data["month"][$i]["internal_code"]
);
$op.id = $responce.data["month"][$i]["internal_code"]; //specifying the id for options
document.getElementById(month_id).options.add($op);
}
$("#" + year_id).val($responce.data["current_year"]);
$("#" + month_id).val($responce.data["current_month"]);
}
},
});
}
|