Advertisement
Guest User

Core.js

a guest
Oct 17th, 2014
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
jQuery 0.62 KB | None | 0 0
  1. var formObject = {
  2.     run : function(obj) {
  3.         if (obj.val() === '') {
  4.             obj.nextAll('.update').html('<option value="">----</option>').attr('disabled', true);
  5.         } else {
  6.             var id = obj.attr('id');
  7.             var v = obj.val();
  8.             jQuery.getJSON('mod/update.php', { id : id, value : v }, function(data) {
  9.                 if (!data.error) {
  10.                     obj.next('.update').html(data.list).removeAttr('disabled');
  11.                 } else {
  12.                     obj.nextAll('.update').html('<option value="">----</option>').attr('disabled', true);
  13.                 }
  14.             });
  15.         }
  16.     }
  17. };
  18. $(function() {
  19.    
  20.     $('.update').live('change', function() {
  21.         formObject.run($(this));
  22.     });
  23.    
  24. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement