If your markup will remain as you've shown, you can get away with
this:
$('select[id^=Branch]').change(function(){
        var _this = $(this);
                ajax_loading_image('.ajax_loading_image');
                
_this.parent().next().load('get_members',{'ajax':true,'id':_this.val
()},function(){
                         ajax_remove_loading_image('.ajax_loading_image');
                });
});

On Mar 1, 7:13 pm, ramonmaruko <ramonmar...@gmail.com> wrote:
> Thank you, it worked perfectly!(aside from the extra ' beside the word
> "Branch")
> Time to understand the code. :D
>
> MorningZ wrote:
> > $('select[id^='Branch]').change(function(){
> >         var idx = this.id.substr(this.id.length - 1);
> >         var selected = $(this).val();
> >         ajax_loading_image('.ajax_loading_image');
> >         $.ajax({
> >             type: "POST",
> >             url: 'get_members',
> >             data: "ajax=true&id="+selected,
> >             success: function(data){
> >                 $('.Comaker' + idx).html(data);
> >                    // remove loading image
> >                 ajax_remove_loading_image('.ajax_loading_image');
> >               }
> >         });
> > });
>
> > extra note:  no need to ".clear" before ".html"
>
> > On Feb 28, 4:28 am, ramonmaruko <ramonmar...@gmail.com> wrote:
> > > Is there a 'better' way of doing this? I think that the code is dirty
> > > since a lot of things are being repeated elsewhere. Tips, hints,
> > > links, etc would be appreciated. Thank you.
>
> > > JQuery code:http://pastebin.com/m3b0c63fb
>
> > > HTML form code:http://pastebin.com/m664f5de6

Reply via email to