Created
November 5, 2018 17:45
-
-
Save staycreativedesign/698d802bd3fff19206eb5b1c062fb05b to your computer and use it in GitHub Desktop.
how can i better write this, if post_category id change then it goes down to change submenu and subcategory, if submenu is changed it changes the subcategory
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
$('#post_category_id').change(function(e){ | |
var cat = this.value | |
$.getScript('/admin/categories/' + this.value + '/submenus', function(e){ | |
var submenu = $('#post_submenu_id').val(); | |
if (submenu == null) { | |
} else { | |
$.getScript('/admin/categories/' + cat + '/submenus/' + submenu + '/subcategories') | |
} | |
}) | |
}) | |
$('#post_submenu_id').change(function(e){ | |
var cat = $('#post_category_id').val(); | |
console.log(this.value) | |
console.log('foo') | |
if (this.value == null) { | |
} else { | |
$.getScript('/admin/categories/' + cat + '/submenus/' + this.value + '/subcategories') | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I am currently having a problem whenever the category is changed I change the submenu but the submenu change isnt fired...