次の 3 つの jQuery ステートメントを組み合わせる方法はありますか?
$("#search_building").change(function () {
var building = $("#search_building").val();
var room = $("#search_room").val();
var dept = $("#dept").val();
var dataString = 'room=' + room + '&' + 'building=' + building + '&' + 'dept=' + dept;
$.ajax({
type: "POST",
url: "process_building.php",
data: dataString,
cache: false,
success: function (html) {
$('#search_room').html(html);
}
});
$.ajax({
type: "POST",
url: "process_timetableMon.php",
data: dataString,
cache: false,
success: function (html) {
$('#grid2_mon').html(html);
}
});
});
$("#search_building").blur(function () {
var building = $("#search_building").val();
var room = $("#search_room").val();
var dept = $("#dept").val();
var dataString = 'room=' + room + '&' + 'building=' + building + '&' + 'dept=' + dept;
$.ajax({
type: "POST",
url: "process_building.php",
data: dataString,
cache: false,
success: function (html) {
$('#search_room').html(html);
}
});
$.ajax({
type: "POST",
url: "process_timetableMon.php",
data: dataString,
cache: false,
success: function (html) {
$('#grid2_mon').html(html);
}
});
});
$("#search_building").ready(function () {
var building = $("#search_building").val();
var room = $("#search_room").val();
var dept = $("#dept").val();
var dataString = 'room=' + room + '&' + 'building=' + building + '&' + 'dept=' + dept;
$.ajax({
type: "POST",
url: "process_timetableMon.php",
data: dataString,
cache: false,
success: function (html) {
$('#grid2_mon').html(html);
}
});
});