2011-06-29 16 views
0

私はいくつかのボタンと選択ボックスがあります。ボタンをクリックすると、AJAXリクエストを送信して、{"ids":{"attr_id":"1","subattr_id":"6"}}
attr_idここにselectboxに設定した値が返されます。 attr_idによれば、第2の選択ボックスが生成され、その値はsubattr_idに設定する必要があります。 .onClick()ボタンイベント:第二の選択ボックスのdidntの交換のjquery .live()、イベントバインディングとajax

$.post(
    function(result){ 
     jQuery(result.ids).each(function(){ 
     var prodAttr = $(this).attr('attr_id'); 
     $('div.attribute_wrapper select.property').change(function(e,eType){ 
      if(eType == 'click') 
      { 
       prodSubattr = $(result.ids).attr('subattr_id'); 
       $(this).trigger('cascadeSelect',prodAttr); 
       //select.subProperty generated by ajax when first selectbox changed 
       $('select.subProperty').trigger('setValue',prodSubattr); 
      } 
     }); 
     $('div.attribute_wrapper select.property').trigger('change',e.type); 
     $('select.subProperty').live('setValue', function(e, subAttr){ 
      $(this).val(subAttr); 
     }); 
    }); 
    } 
) 

値。 だから私はこの問題についていくつかの助けが必要です。

答えて

0

setValueはイベントではありません。関数を作成し、代わりに呼び出すことを検討してください。

http://api.jquery.com/live/

+0

setValueのは、第一選択ボックスが変更されたとき、私はトリガーにしたい私のカスタムイベント、です。 –