Guest User

Untitled

a guest
Aug 17th, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. @helper DynamicDropDowns() {
  2. <script type="text/javascript">
  3. function listChanged($list, $target, url) {
  4. var listId = $list.val();
  5. if (listId == "") { // User selected first option, so clear and disable the list
  6. $target.empty();
  7. enableList($target, false);
  8. return;
  9. }
  10. $.getJSON(url, { id: listId }, function (data) {
  11. $target.empty(); // Clear the list
  12. $.each(data, function (idx, item) { // Add the data
  13. $target.append($("<option/>",
  14. {
  15. value: item.Value,
  16. text: item.Text
  17. }));
  18. });
  19. enableList($target, true); // Enable the list
  20. });
  21. }
  22.  
  23. function enableList($list, enabled) {
  24. $list.attr("disabled", enabled ? null : "disabled");
  25. }
  26. </script>
  27. }
Add Comment
Please, Sign In to add comment