$(document).ready(function () {
$('#Rack_Class_ID').change(function () {
var ClassId = $(this).val();
var EventId = $('#Rack_Class_ID').data('event-id');
if (ClassId > 0) {
$.ajax({
type: "POST",
url: "/ajax/ajax_get_rack_data_by_class-p.php",
data: "&Class_ID=" + ClassId + "&Event_ID=" + EventId,
async: false,
dataType: 'json',
success: function (jsonObj) {
$("#Rack_Data_ID").children("option:gt(0)").remove();
for (k in jsonObj) {
$("#Rack_Data_ID").append('');
}
}
});
}
});
//發票載具
$("#Invo_Data").on('change', "#CarrierType", function () {
if ($(this).val() > 1) {
$(".invo_code").show().find("input").attr("fun", "checkNull");
} else {
$(".invo_code").hide().find("input").attr("fun", "");
}
});
//國別
var address_type = $('#Country_ID').find('option:selected').attr('address-type');
if (address_type == 3) {
$("#City_ID, #Area_ID").hide();
$("#City_ID, #Area_ID").attr('fun', '');
} else if (address_type == 2) {
$("#Area_ID").hide();
$("#Area_ID").attr('fun', '');
$("#City_ID").show();
$("#City_ID").attr('fun', 'checkNull');
} else {
$("#City_ID, #Area_ID").show();
$("#City_ID, #Area_ID").attr('fun', 'checkNull');
}
$("#Country_ID").on('change', function() {
var the_sub = 'City_ID';
$.ajax({
type: "POST",
url: Project_Country + "ajax/ajax_get_city-p.php",
data: "&Send_ID=" + $(this).val(),
async: false,
dataType: 'json',
error: function(d) {
alert('網路連線過慢,網頁請重新整理');
},
success: function(jsonObj) {
$("#" + the_sub).children("option:gt(0)").remove();
for (k in jsonObj) {
$("#" + the_sub).append('');
}
}
});
var address_type = $(this).find('option:selected').attr('address-type');
if (address_type == 3) {
$("#City_ID, #Area_ID").hide();
$("#City_ID, #Area_ID").attr('fun', '');
} else if (address_type == 2) {
$("#Area_ID").hide();
$("#Area_ID").attr('fun', '');
$("#City_ID").show();
$("#City_ID").attr('fun', 'checkNull');
} else {
$("#City_ID, #Area_ID").show();
$("#City_ID, #Area_ID").attr('fun', 'checkNull');
}
});
$("#City_ID").on('change', function() {
var the_sub = 'Area_ID';
$.ajax({
type: "POST",
url: Project_Country + "ajax/ajax_get_area-p.php",
data: "&Send_ID=" + $(this).val(),
async: false,
dataType: 'json',
error: function(d) {
alert('網路連線過慢,網頁請重新整理');
},
success: function(jsonObj) {
$("#" + the_sub).children("option:gt(0)").remove();
for (k in jsonObj.area) {
$("#" + the_sub).append('');
}
}
});
});
//預產期(日期)選擇
$(".DATE").datetimepicker({
format:'YYYY-MM-DD',
widgetPositioning: {
horizontal: 'auto',
vertical:'auto'
},
debug: true,
});
})