jquery ajax triggering another jquery ajax
I have drop-downs for:
1. manufacturer 2. products 3. coloursManufacturer drop is fetched with page.
When I select manuf. from it Ajax appends #2. When I select product, Ajax appends #3Problem is, that #3 is is not being fetched.
I appreciate a hint.Code I use:
$("#manuf").change(function(){ var manuf_id = $("#manuf").val(); $.ajax({ type: "POST", url: "ajax_product_preload.php", 开发者_开发问答 data: "manuf_id=" + manuf_id, success: function(data){ $("#prod_div").hide().html(data).fadeIn(); } }); });
Code for colour is similar, just a IDs, php file and data string change.
Php files are simple db queries and dropdowns, so posting them would be a waste of SO hdd .. I guess.You are binding the change handler for #2's content before it loads, right? If that is the case, you can likely fix your problem using .live()
:
$("#prod").live('change', function(){
assuming that #prod
is the select
element that contains the list of products.
精彩评论