我在JQUery中编写一个脚本,当你从通过AJAX引入的选择框中选择一个选项时,它会根据你的选择从数据库中加载结果......
我知道当你通过AJAX引入数据时,你必须使用.live()来使用事件,但是我似乎仍然遇到问题。
任何想法:
$('#schoolselect').live('blur',function(){
school = $(this).val();
console.log(school);
$.ajax({
type: "POST",
url: "./script/moduleandcourse.php",
data: {school:school,type:choice},
dataType: "html",
success: function(result){
console.log(choice);
$('#module_section').html(result).fadeIn(500);
console.log('#' + choice + 'select');
}
})
});
$('#moduleselect').live(blur,function(){
console.log("Selection Made");
});
从AJAX初始返回的选择框的ID是moduleselect。
任何帮助都会有很大帮助:D
答案 0 :(得分:1)
你能用引号模糊吗?这似乎是个问题。
$('#moduleselect').live('blur',function(){
console.log("Selection Made");
});