715 posts
  • Has sold $100+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Sells items exclusively on Envato Market
  • Located in Belgium
+1 more
Hy-Studio says

Hi!

I’m making a jquery script that get’s another file and sends parameters to it.

Here’s the way it should work (select option lists only):

  • user selects a depot number
  • an option list with years are displayed, user selects year
  • an option list with months are displayed, user selects month
  • an option list with days are displayed, user selects day

after selecting day they get a result with images (it’s for our intranet so I can’t show you a live version).

The problem lies when the user selects the year, I see in firebug that he gets the file which displays the months but then he gets the file where the years are displayed, so it’s like he’s getting two files instead of 1.

Strange thing is that this problem only occurs after selecting the depot, so this problem lies with selecting year, month and day and not the first option to select.

here’s my code:

$(document).ready(function(){

$('.selectDepot').live("change", function(){

            var depot = $(this).val();

            if( depot == 'Select Depot' ){

                $('.selectYear, .selectMonth, .selectDay, input.button').hide();

            }else{

                $.get('selectYear.php', { 'depot': depot }, function(data){
                    $('.imgDrop01').show().html(data);                    
                });

            }

        });

$('.selectYear').live("change", function(){

                    var depot = $(".selectDepot option:selected" ).val(),
                        year = $(this).val();

                    if(year == 'Select Year'){

                        $('.selectMonth, .selectDay, input.button').hide();

                    }else{
                        $.get('selectMonth.php', {'depot': depot, 'year': year}, function(data){
                            $('.imgDrop02').html(data);
                        });
                    }

                });

                $('.selectMonth').live("click", function(){

                    var depot = $(".selectDepot option:selected").val(),
                        year  = $(".selectYear option:selected").val(),
                        month = $(this).val();

                    if( month == "Select Month" ){

                        $('.selectDay, input.button').hide();

                    }else{
                        $.get("selectDay.php", {'depot': depot, 'year': year, 'month': month}, function(data){
                            $('.imgDrop03').html(data);
                        });
                    }

                });

}

jQuery code for the day isn’t finished yet.

Anyone an idea?

Thanks!

Helpful Information

  • Please read our community guidelines. Self promotion and discussion of piracy is not allowed.
  • Open a support ticket if you would like specific help with your account, deposits or purchases.
  • Item Support by authors is optional and may vary. Please see the Support tab on each item page.

Most of all, enjoy your time here. Thank you for being a valued Envato community member.

Post Reply

Format your entry with some basic HTML. Read the Full Details, or here is a refresher:

<strong></strong> to make things bold
<em></em> to emphasize
<ul><li> or <ol><li> to make lists
<h3> or <h4> to make headings
<pre></pre> for code blocks
<code></code> for a few words of code
<a></a> for links
<img> to paste in an image (it'll need to be hosted somewhere else though)
<blockquote></blockquote> to quote somebody

:grin: :shocked: :cry: Complete List of Smiley Codes

by
by
by
by
by
by