Guest User

Untitled

a guest
Jun 21st, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. // After defaults are checked, add event handler & enable checkbox
  2. jQuery('#attributes input[type="checkbox"]').bind('change', function() {
  3. jQuery(this).attr('disabled', 'disabled');
  4.  
  5. if (this.checked) {
  6. jQuery.post(adminAjaxUrl, {
  7. action : "updateAttributeAssoication",
  8. sqlAction : 'insert',
  9. listingCategoryId : jQuery('#listing_categories').val(),
  10. attributeId : jQuery(this).val()
  11. }, function(results) {
  12. jQuery(this).removeAttr('disabled');
  13. });
  14. }
  15.  
  16. if (!this.checked) {
  17. jQuery.post(adminAjaxUrl, {
  18. action : "updateAttributeAssoication",
  19. sqlAction: 'delete',
  20. listingCategoryId : jQuery('#listing_categories').val(),
  21. attributeId : jQuery(this).val()
  22. }, function(results) {
  23. jQuery(this).removeAttr('disabled');
  24. });
  25. }
  26. });
Add Comment
Please, Sign In to add comment