Js:
$dialog.find("select[name=materialunitid]").change(function() {
if ($(this).val()) {
$dialog.find("select[name=productid]").removeAttr("disabled");
$.ajax({
url: contextPath + "/jobcontent/getproductsbyunitid.do?unitid=" + $(this).val() + "&t=" + $.now(),
async: false,
dataType: "json",
success: function(data) {
var $select = $dialog.find("select[name=productid]").empty();
$select.append(new Option("Select...", ""));
if (data && data.length) {
$.each(data, function(i, t) {
$select.append(new Option(t.productname, t.id));
});
}
}
});
}
}