Created
February 27, 2014 13:58
-
-
Save kkreft/9250544 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $j('#category_id').change(function() { | |
| var category_id = $j('#category_id option:selected').val(); | |
| $j("#subcategory_id").after('<div class="loading left"><img src="/templates/system/images/loading.gif" /></div>'); | |
| if(category_id == '') { | |
| $j('#subcategory_id').attr('disabled', 'disabled'); | |
| $j('.loading').remove(); | |
| } | |
| else { | |
| jQuery.ajax({ | |
| url: 'index.php', | |
| type: 'POST', | |
| dataType: 'json', | |
| data: {category_id: category_id}, | |
| success: function(data, textStatus, xhr) { | |
| $j('.loading').remove(); | |
| $j('#subcategory_id').removeAttr('disabled'); | |
| $j('#subcategory_id option').remove(); | |
| var html = '<option selected="selected">Wszystkie</option>'; | |
| $j.each(data, function(val, name) { | |
| html = html+'<option value="'+val+'">'+name+'</option>' | |
| }); | |
| $j('#subcategory_id').append(html); | |
| }, | |
| }); | |
| } | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment