jquery - Populate two different combo boxes using AJAX at a time -


i have 3 combo box: department, courses, activities. department combo box load departments department table. need load courses in 1 combo box , activities in combo box belong department. table schema shown below.

    department table     ----------------     | dept | name  |     ----------------     | 1    | dept1 |     | 2    | dept2 |     ----------------      department course table     ----------------------     | cid |dept | course |     ----------------------     | 1   | 1   | abc    |     | 2   | 1   | xyz    |     | 3   | 1   | pqr    |     | 4   | 2   | bar    |     | 5   | 2   | foo    |     ----------------------      department activities table     ---------------------------     | aid | dept | activities |     ---------------------------     | 1   | 1    | foo1       |     | 2   | 1    | foo2       |     | 3   | 1    | foo3       |     | 4   | 2    | bar1       |     | 5   | 2    | bar2       |     --------------------------- 

department combo box load dept 1 , dept 2. when dept1 select courses belong dept1 should load in courses combo box i.e (abc,xyx,pqr) , activities which belong dept1 should load in activities combo box i.e (foo1,foo2,foo3).

how call 2 functions @ same time in ajax or jquery?

you can :

$('#department_combo').change(function(){     $.ajax({         url: "/someurl/courses",         success: function(data) {             // populate courses data         }     });     $.ajax({         url: "/someurl/activities",         success: function(data) {             // populate activities data         }     }); }); 

Comments

Popular posts from this blog

curl - PHP fsockopen help required -

HTTP/1.0 407 Proxy Authentication Required PHP -

c# - Resource not found error -