0

I am writing a script in JQUery that when you select an option from a select box that has been brought in through AJAX, it loads results from a database based on your selection...

I know that when you bring in data via AJAX, you have to use .live() to use events, however i still seem too get problems.

Any ideas:

$('#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");

 });

the ID of the select box initally returned from AJAX is moduleselect.

Any help would be much apreciated :D

4

1 回答 1

1

Can you give blur in quotes? That seems to be the issue.

$('#moduleselect').live('blur',function(){
    console.log("Selection Made");
});
于 2012-04-20T11:48:44.917 回答